mirror of
https://github.com/primefaces/primevue.git
synced 2025-05-09 00:42:36 +00:00
Fixed #5099 - autoOptionFocus property added to Input-like components
This commit is contained in:
parent
c8609171c2
commit
54a7a4fb50
10 changed files with 60 additions and 13 deletions
|
@ -301,18 +301,19 @@ export default {
|
|||
return ObjectUtils.findIndexInList(item, this.d_selection[listIndex]) != -1;
|
||||
},
|
||||
onListFocus(event, listType) {
|
||||
const selectedFirstItem = DomHandler.findSingle(this.$refs[listType].$el, '[data-p-highlight="true"]') || DomHandler.findSingle(this.$refs[listType].$el, '[data-pc-section="item"]');
|
||||
this.focused[listType] = true;
|
||||
const selectedFirstItem = this.autoOptionFocus
|
||||
? DomHandler.findSingle(this.$refs[listType].$el, '[data-p-highlight="true"]') || DomHandler.findSingle(this.$refs[listType].$el, '[data-pc-section="item"]')
|
||||
: DomHandler.findSingle(this.$refs[listType].$el, '[data-p-highlight="true"]');
|
||||
|
||||
if (selectedFirstItem) {
|
||||
const findIndex = ObjectUtils.findIndexInList(selectedFirstItem, this.$refs[listType].$el.children);
|
||||
|
||||
this.focused[listType] = true;
|
||||
|
||||
const index = this.focusedOptionIndex !== -1 ? this.focusedOptionIndex : selectedFirstItem ? findIndex : -1;
|
||||
|
||||
this.changeFocusedOptionIndex(index, listType);
|
||||
this.$emit('focus', event);
|
||||
}
|
||||
|
||||
this.$emit('focus', event);
|
||||
},
|
||||
onListBlur(event, listType) {
|
||||
this.focused[listType] = false;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue