mirror of
https://github.com/primefaces/primevue.git
synced 2025-05-09 00:42:36 +00:00
Fixed #4500 - Theme updates: change :focus to focus-visible
This commit is contained in:
parent
045820d0fa
commit
f40b8fb178
51 changed files with 1672 additions and 1669 deletions
|
@ -31,7 +31,7 @@ const classes = {
|
|||
cancelItem: ({ instance }) => [
|
||||
'p-rating-item p-rating-cancel-item',
|
||||
{
|
||||
'p-focus': instance.focusedOptionIndex === 0
|
||||
'p-focus': instance.focusedOptionIndex === 0 && instance.isFocusVisibleItem
|
||||
}
|
||||
],
|
||||
cancelIcon: 'p-rating-icon p-rating-cancel',
|
||||
|
@ -39,7 +39,7 @@ const classes = {
|
|||
'p-rating-item',
|
||||
{
|
||||
'p-rating-item-active': value <= props.modelValue,
|
||||
'p-focus': value === instance.focusedOptionIndex
|
||||
'p-focus': value === instance.focusedOptionIndex && instance.isFocusVisibleItem
|
||||
}
|
||||
],
|
||||
onIcon: 'p-rating-icon',
|
||||
|
|
|
@ -62,7 +62,8 @@ export default {
|
|||
data() {
|
||||
return {
|
||||
name: this.$attrs.name,
|
||||
focusedOptionIndex: -1
|
||||
focusedOptionIndex: -1,
|
||||
isFocusVisibleItem: true
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
|
@ -85,6 +86,7 @@ export default {
|
|||
onOptionClick(event, value) {
|
||||
if (!this.readonly && !this.disabled) {
|
||||
this.onOptionSelect(event, value);
|
||||
this.isFocusVisibleItem = false;
|
||||
const firstFocusableEl = DomHandler.getFirstFocusableElement(event.currentTarget);
|
||||
|
||||
firstFocusableEl && DomHandler.focus(firstFocusableEl);
|
||||
|
@ -100,6 +102,7 @@ export default {
|
|||
},
|
||||
onChange(event, value) {
|
||||
this.onOptionSelect(event, value);
|
||||
this.isFocusVisibleItem = true;
|
||||
},
|
||||
onOptionSelect(event, value) {
|
||||
this.focusedOptionIndex = value;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue