Refactor for accessibility

pull/2929/head
mertsincan 2022-09-01 10:30:04 +01:00
parent 5ed1341cff
commit e2a631657b
7 changed files with 21 additions and 22 deletions

View File

@ -61,7 +61,6 @@ export default {
}, },
data() { data() {
return { return {
id: UniqueComponentId(),
d_activeIndex: this.activeIndex d_activeIndex: this.activeIndex
} }
}, },
@ -70,9 +69,6 @@ export default {
this.d_activeIndex = newValue; this.d_activeIndex = newValue;
} }
}, },
mounted() {
this.id = this.$attrs.id || this.id;
},
methods: { methods: {
isAccordionTab(child) { isAccordionTab(child) {
return child.type.name === 'AccordionTab'; return child.type.name === 'AccordionTab';
@ -240,6 +236,9 @@ export default {
return tabs; return tabs;
}, []); }, []);
},
id() {
return this.$attrs.id || UniqueComponentId();
} }
}, },
directives: { directives: {

View File

@ -201,7 +201,6 @@ export default {
dirty: false, dirty: false,
data() { data() {
return { return {
id: UniqueComponentId(),
focused: false, focused: false,
focusedOptionIndex: -1, focusedOptionIndex: -1,
focusedMultipleOptionIndex: -1, focusedMultipleOptionIndex: -1,
@ -221,8 +220,6 @@ export default {
} }
}, },
mounted() { mounted() {
this.id = this.$attrs.id || this.id;
this.autoUpdateModel(); this.autoUpdateModel();
}, },
updated() { updated() {
@ -908,6 +905,9 @@ export default {
selectedMessageText() { selectedMessageText() {
return this.hasSelectedOption ? this.selectionMessageText.replaceAll('{0}', this.multiple ? this.modelValue.length : '1') : this.emptySelectionMessageText; return this.hasSelectedOption ? this.selectionMessageText.replaceAll('{0}', this.multiple ? this.modelValue.length : '1') : this.emptySelectionMessageText;
}, },
id() {
return this.$attrs.id || UniqueComponentId();
},
focusedOptionId() { focusedOptionId() {
return this.focusedOptionIndex !== -1 ? `${this.id}_${this.focusedOptionIndex}` : null; return this.focusedOptionIndex !== -1 ? `${this.id}_${this.focusedOptionIndex}` : null;
}, },

View File

@ -129,7 +129,6 @@ export default {
focusOnHover: false, focusOnHover: false,
data() { data() {
return { return {
id: UniqueComponentId(),
focused: false, focused: false,
focusedOptionInfo: { index: -1, level: 0, parentKey: '' }, focusedOptionInfo: { index: -1, level: 0, parentKey: '' },
activeOptionPath: [], activeOptionPath: [],
@ -143,8 +142,6 @@ export default {
} }
}, },
mounted() { mounted() {
this.id = this.$attrs.id || this.id;
this.autoUpdateModel(); this.autoUpdateModel();
}, },
beforeUnmount() { beforeUnmount() {
@ -760,6 +757,9 @@ export default {
selectedMessageText() { selectedMessageText() {
return this.hasSelectedOption ? this.selectionMessageText.replaceAll('{0}', '1') : this.emptySelectionMessageText; return this.hasSelectedOption ? this.selectionMessageText.replaceAll('{0}', '1') : this.emptySelectionMessageText;
}, },
id() {
return this.$attrs.id || UniqueComponentId();
},
focusedOptionId() { focusedOptionId() {
return this.focusedOptionInfo.index !== -1 ? `${this.id}${ObjectUtils.isNotEmpty(this.focusedOptionInfo.parentKey) ? '_' + this.focusedOptionInfo.parentKey : ''}_${this.focusedOptionInfo.index}` : null; return this.focusedOptionInfo.index !== -1 ? `${this.id}${ObjectUtils.isNotEmpty(this.focusedOptionInfo.parentKey) ? '_' + this.focusedOptionInfo.parentKey : ''}_${this.focusedOptionInfo.index}` : null;
} }

View File

@ -197,7 +197,6 @@ export default {
focusOnHover: false, focusOnHover: false,
data() { data() {
return { return {
id: UniqueComponentId(),
focused: false, focused: false,
focusedOptionIndex: -1, focusedOptionIndex: -1,
filterValue: null, filterValue: null,
@ -213,8 +212,6 @@ export default {
} }
}, },
mounted() { mounted() {
this.id = this.$attrs.id || this.id;
this.autoUpdateModel(); this.autoUpdateModel();
}, },
updated() { updated() {
@ -874,6 +871,9 @@ export default {
selectedMessageText() { selectedMessageText() {
return this.hasSelectedOption ? this.selectionMessageText.replaceAll('{0}', '1') : this.emptySelectionMessageText; return this.hasSelectedOption ? this.selectionMessageText.replaceAll('{0}', '1') : this.emptySelectionMessageText;
}, },
id() {
return this.$attrs.id || UniqueComponentId();
},
focusedOptionId() { focusedOptionId() {
return this.focusedOptionIndex !== -1 ? `${this.id}_${this.focusedOptionIndex}` : null; return this.focusedOptionIndex !== -1 ? `${this.id}_${this.focusedOptionIndex}` : null;
}, },

View File

@ -142,7 +142,6 @@ export default {
focusOnHover: false, focusOnHover: false,
data() { data() {
return { return {
id: UniqueComponentId(),
filterValue: null, filterValue: null,
focused: false, focused: false,
focusedOptionIndex: -1 focusedOptionIndex: -1
@ -154,8 +153,6 @@ export default {
} }
}, },
mounted() { mounted() {
this.id = this.$attrs.id || this.id;
this.autoUpdateModel(); this.autoUpdateModel();
}, },
methods: { methods: {
@ -685,6 +682,9 @@ export default {
selectedMessageText() { selectedMessageText() {
return this.hasSelectedOption ? this.selectionMessageText.replaceAll('{0}', this.multiple ? this.modelValue.length : '1') : this.emptySelectionMessageText; return this.hasSelectedOption ? this.selectionMessageText.replaceAll('{0}', this.multiple ? this.modelValue.length : '1') : this.emptySelectionMessageText;
}, },
id() {
return this.$attrs.id || UniqueComponentId();
},
focusedOptionId() { focusedOptionId() {
return this.focusedOptionIndex !== -1 ? `${this.id}_${this.focusedOptionIndex}` : null; return this.focusedOptionIndex !== -1 ? `${this.id}_${this.focusedOptionIndex}` : null;
}, },

View File

@ -247,7 +247,6 @@ export default {
focusOnHover: false, focusOnHover: false,
data() { data() {
return { return {
id: UniqueComponentId(),
focused: false, focused: false,
focusedOptionIndex: -1, focusedOptionIndex: -1,
headerCheckboxFocused: false, headerCheckboxFocused: false,
@ -261,8 +260,6 @@ export default {
} }
}, },
mounted() { mounted() {
this.id = this.$attrs.id || this.id;
this.autoUpdateModel(); this.autoUpdateModel();
}, },
beforeUnmount() { beforeUnmount() {
@ -1027,6 +1024,9 @@ export default {
selectedMessageText() { selectedMessageText() {
return this.hasSelectedOption ? this.selectionMessageText.replaceAll('{0}', this.modelValue.length) : this.emptySelectionMessageText; return this.hasSelectedOption ? this.selectionMessageText.replaceAll('{0}', this.modelValue.length) : this.emptySelectionMessageText;
}, },
id() {
return this.$attrs.id || UniqueComponentId();
},
focusedOptionId() { focusedOptionId() {
return this.focusedOptionIndex !== -1 ? `${this.id}_${this.focusedOptionIndex}` : null; return this.focusedOptionIndex !== -1 ? `${this.id}_${this.focusedOptionIndex}` : null;
}, },

View File

@ -67,7 +67,6 @@ export default {
}, },
data() { data() {
return { return {
id: UniqueComponentId(),
d_activeIndex: this.activeIndex, d_activeIndex: this.activeIndex,
focusedTabIndex: -1, focusedTabIndex: -1,
isPrevButtonDisabled: true, isPrevButtonDisabled: true,
@ -82,8 +81,6 @@ export default {
} }
}, },
mounted() { mounted() {
this.id = this.$attrs.id || this.id;
this.updateInkBar(); this.updateInkBar();
}, },
updated() { updated() {
@ -304,6 +301,9 @@ export default {
}, },
nextButtonAriaLabel() { nextButtonAriaLabel() {
return this.$primevue.config.locale.aria ? this.$primevue.config.locale.aria.next : undefined; return this.$primevue.config.locale.aria ? this.$primevue.config.locale.aria.next : undefined;
},
id() {
return this.$attrs.id || UniqueComponentId();
} }
}, },
directives: { directives: {