trigger change on wheeling inside <select>
This commit is contained in:
parent
b840d4897d
commit
5196f96ee3
|
@ -98,7 +98,11 @@ document.addEventListener('wheel', event => {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (el.tagName === 'SELECT') {
|
if (el.tagName === 'SELECT') {
|
||||||
el.selectedIndex = Math.max(0, Math.min(el.length - 1, el.selectedIndex + Math.sign(event.deltaY)));
|
const old = el.selectedIndex;
|
||||||
|
el.selectedIndex = Math.max(0, Math.min(el.length - 1, old + Math.sign(event.deltaY)));
|
||||||
|
if (el.selectedIndex !== old) {
|
||||||
|
el.dispatchEvent(new Event('change', {bubbles: true}));
|
||||||
|
}
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
}
|
}
|
||||||
event.stopImmediatePropagation();
|
event.stopImmediatePropagation();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user