fix issue with dropdown on Chrome
parent
28315b371b
commit
7cfbc3579d
|
@ -125,7 +125,6 @@ export class SeList extends HTMLElement {
|
||||||
connectedCallback () {
|
connectedCallback () {
|
||||||
const currentObj = this;
|
const currentObj = this;
|
||||||
this.$dropdown.addEventListener('selectedindexchange', (e) => {
|
this.$dropdown.addEventListener('selectedindexchange', (e) => {
|
||||||
e.preventDefault();
|
|
||||||
if (e?.detail?.selectedIndex !== undefined) {
|
if (e?.detail?.selectedIndex !== undefined) {
|
||||||
const value = this.$dropdown.selectedItem.getAttribute('value');
|
const value = this.$dropdown.selectedItem.getAttribute('value');
|
||||||
const closeEvent = new CustomEvent('change', { detail: { value } });
|
const closeEvent = new CustomEvent('change', { detail: { value } });
|
||||||
|
@ -133,6 +132,12 @@ export class SeList extends HTMLElement {
|
||||||
currentObj.value = value;
|
currentObj.value = value;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
this.$dropdown.addEventListener('close', (e) => {
|
||||||
|
/** @todo: with Chrome, selectedindexchange does not fire consistently
|
||||||
|
* unless you forec change in this close event
|
||||||
|
*/
|
||||||
|
this.$dropdown.selectedIndex = this.$dropdown.currentIndex;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue