fix issue with dropdown on Chrome

master
JFH 2021-06-06 00:08:28 +02:00
parent 28315b371b
commit 7cfbc3579d
1 changed files with 6 additions and 1 deletions

View File

@ -125,7 +125,6 @@ export class SeList extends HTMLElement {
connectedCallback () {
const currentObj = this;
this.$dropdown.addEventListener('selectedindexchange', (e) => {
e.preventDefault();
if (e?.detail?.selectedIndex !== undefined) {
const value = this.$dropdown.selectedItem.getAttribute('value');
const closeEvent = new CustomEvent('change', { detail: { value } });
@ -133,6 +132,12 @@ export class SeList extends HTMLElement {
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;
});
}
}