Refactor #1451 - For keyboard support on Dropdown
parent
3f003a9817
commit
4cfa62f29e
|
@ -138,6 +138,11 @@ export default {
|
||||||
overlayVisible: false
|
overlayVisible: false
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
watch: {
|
||||||
|
modelValue() {
|
||||||
|
this.isModelValueChanged = true;
|
||||||
|
}
|
||||||
|
},
|
||||||
outsideClickListener: null,
|
outsideClickListener: null,
|
||||||
scrollHandler: null,
|
scrollHandler: null,
|
||||||
resizeListener: null,
|
resizeListener: null,
|
||||||
|
@ -148,6 +153,14 @@ export default {
|
||||||
overlay: null,
|
overlay: null,
|
||||||
itemsWrapper: null,
|
itemsWrapper: null,
|
||||||
virtualScroller: null,
|
virtualScroller: null,
|
||||||
|
isModelValueChanged: false,
|
||||||
|
updated() {
|
||||||
|
if (this.overlayVisible && this.isModelValueChanged) {
|
||||||
|
this.scrollValueInView();
|
||||||
|
}
|
||||||
|
|
||||||
|
this.isModelValueChanged = false;
|
||||||
|
},
|
||||||
beforeUnmount() {
|
beforeUnmount() {
|
||||||
this.unbindOutsideClickListener();
|
this.unbindOutsideClickListener();
|
||||||
this.unbindResizeListener();
|
this.unbindResizeListener();
|
||||||
|
@ -611,7 +624,7 @@ export default {
|
||||||
if (this.overlay) {
|
if (this.overlay) {
|
||||||
let selectedItem = DomHandler.findSingle(this.overlay, 'li.p-highlight');
|
let selectedItem = DomHandler.findSingle(this.overlay, 'li.p-highlight');
|
||||||
if (selectedItem) {
|
if (selectedItem) {
|
||||||
this.itemsWrapper.scrollTop = selectedItem.offsetTop;
|
selectedItem.scrollIntoView({ block: 'nearest', inline: 'start' });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue