pull/1544/head
mertsincan 2021-09-15 09:39:40 +03:00
parent d9d871efb6
commit 18c228eda6
1 changed files with 5 additions and 11 deletions

View File

@ -189,6 +189,10 @@ export default {
this.bindOutsideClickListener(); this.bindOutsideClickListener();
this.bindScrollListener(); this.bindScrollListener();
this.bindResizeListener(); this.bindResizeListener();
if (this.autoHighlight && this.suggestions && this.suggestions.length) {
DomHandler.addClass(this.overlay.firstElementChild.firstElementChild, 'p-highlight')
}
}, },
onOverlayLeave() { onOverlayLeave() {
this.unbindOutsideClickListener(); this.unbindOutsideClickListener();
@ -325,10 +329,6 @@ export default {
}, },
showOverlay() { showOverlay() {
this.overlayVisible = true; this.overlayVisible = true;
setTimeout(()=>{
this.autoHighlightFirstItem()
},200)
}, },
hideOverlay() { hideOverlay() {
this.overlayVisible = false; this.overlayVisible = false;
@ -391,16 +391,10 @@ export default {
onBlur() { onBlur() {
this.focused = false; this.focused = false;
}, },
autoHighlightFirstItem() {
if (this.autoHighlight && this.suggestions && this.suggestions.length) {
const itemToHighlight = this.overlay.firstElementChild.firstElementChild
DomHandler.addClass(itemToHighlight, 'p-highlight')
}
},
onKeyDown(event) { onKeyDown(event) {
if (this.overlayVisible) { if (this.overlayVisible) {
let highlightItem = DomHandler.findSingle(this.overlay, 'li.p-highlight'); let highlightItem = DomHandler.findSingle(this.overlay, 'li.p-highlight');
switch(event.which) { switch(event.which) {
//down //down
case 40: case 40: