Fixed #5144 - Keyboard accessibility is not working on OrderList and PickList

pull/5161/head
mertsincan 2024-01-24 16:22:47 +00:00
parent f7f857be9d
commit 0512362f38
2 changed files with 13 additions and 14 deletions

View File

@ -142,6 +142,7 @@ export default {
onListFocus(event) {
this.focused = true;
this.findCurrentFocusedIndex();
this.scrollInView(this.focusedOptionIndex);
this.$emit('focus', event);
},
onListBlur(event) {
@ -189,9 +190,7 @@ export default {
}
},
onOptionMouseDown(event, index) {
this.focused = true;
this.focusedOptionIndex = `${this.id}_${index}`;
event.preventDefault();
this.changeFocusedOptionIndex(index);
},
onOptionMouseMove(index) {
if (this.focusOnHover && this.focused) {
@ -282,13 +281,13 @@ export default {
return DomHandler.findSingle(this.list, `[data-pc-section="item"][id=${this.focusedOptionIndex}]`);
},
findCurrentFocusedIndex() {
this.focusedOptionIndex = this.findFirstSelectedOptionIndex();
if (this.focusedOptionIndex === -1) {
this.focusedOptionIndex = this.findFirstSelectedOptionIndex();
if (this.autoOptionFocus && this.focusedOptionIndex === -1) {
this.focusedOptionIndex = this.findFirstFocusedOptionIndex();
if (this.autoOptionFocus && this.focusedOptionIndex === -1) {
this.focusedOptionIndex = this.findFirstFocusedOptionIndex();
}
}
this.scrollInView(this.focusedOptionIndex);
},
findFirstFocusedOptionIndex() {
const firstFocusableItem = DomHandler.findSingle(this.list, '[data-pc-section="item"]');

View File

@ -304,6 +304,7 @@ export default {
onListFocus(event, listType) {
this.focused[listType] = true;
this.findCurrentFocusedIndex(listType);
this.scrollInView(this.focusedOptionIndex, listType);
this.$emit('focus', event);
},
onListBlur(event, listType) {
@ -314,7 +315,6 @@ export default {
onOptionMouseDown(event, index, listType) {
this.focused[listType] = true;
this.focusedOptionIndex = index;
event.preventDefault();
},
onOptionMouseMove(index, listType) {
if (this.focusOnHover && this.focused[listType]) {
@ -752,13 +752,13 @@ export default {
return DomHandler.findSingle(this.$refs[listType].$el, `[data-pc-section="item"][id=${this.focusedOptionIndex}]`);
},
findCurrentFocusedIndex(listType) {
this.focusedOptionIndex = this.findFirstSelectedOptionIndex(listType);
if (this.focusedOptionIndex === -1) {
this.focusedOptionIndex = this.findFirstSelectedOptionIndex(listType);
if (this.autoOptionFocus && this.focusedOptionIndex === -1) {
this.focusedOptionIndex = this.findFirstFocusedOptionIndex(listType);
if (this.autoOptionFocus && this.focusedOptionIndex === -1) {
this.focusedOptionIndex = this.findFirstFocusedOptionIndex(listType);
}
}
this.scrollInView(this.focusedOptionIndex, listType);
},
findFirstFocusedOptionIndex(listType) {
const firstFocusableItem = DomHandler.findSingle(this.$refs[listType].$el, '[data-pc-section="item"]');