mirror of
https://github.com/primefaces/primevue.git
synced 2025-05-10 09:22:34 +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
|
@ -140,18 +140,19 @@ export default {
|
|||
return ObjectUtils.findIndexInList(item, this.d_selection) != -1;
|
||||
},
|
||||
onListFocus(event) {
|
||||
const selectedFirstItem = DomHandler.findSingle(this.list, '[data-p-highlight="true"]') || DomHandler.findSingle(this.list, '[data-pc-section="item"]');
|
||||
this.focused = true;
|
||||
const selectedFirstItem = this.autoOptionFocus
|
||||
? DomHandler.findSingle(this.list, '[data-p-highlight="true"]') || DomHandler.findSingle(this.list, '[data-pc-section="item"]')
|
||||
: DomHandler.findSingle(this.list, '[data-p-highlight="true"]');
|
||||
|
||||
if (selectedFirstItem) {
|
||||
const findIndex = ObjectUtils.findIndexInList(selectedFirstItem, this.list.children);
|
||||
|
||||
this.focused = true;
|
||||
|
||||
const index = this.focusedOptionIndex !== -1 ? this.focusedOptionIndex : selectedFirstItem ? findIndex : -1;
|
||||
|
||||
this.changeFocusedOptionIndex(index);
|
||||
this.$emit('focus', event);
|
||||
}
|
||||
|
||||
this.$emit('focus', event);
|
||||
},
|
||||
onListBlur(event) {
|
||||
this.focused = false;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue