diff --git a/edit/source-editor.js b/edit/source-editor.js index c4d1c041..7119cfa5 100644 --- a/edit/source-editor.js +++ b/edit/source-editor.js @@ -350,9 +350,6 @@ function createSourceEditor({style, onTitleChanged}) { } function headerOnScroll({target, deltaY, deltaMode, shiftKey}) { - if (target.tagName === 'INPUT' && target.type === 'number') { - return; - } while ((target = target.parentElement)) { if (deltaY < 0 && target.scrollTop || deltaY > 0 && target.scrollTop + target.clientHeight < target.scrollHeight) { diff --git a/js/dom.js b/js/dom.js index 5b1d39b4..db9d9f0f 100644 --- a/js/dom.js +++ b/js/dom.js @@ -91,6 +91,21 @@ document.addEventListener('click', e => { e.preventDefault(); } }); +// update inputs on mousewheel when focused +document.addEventListener('wheel', event => { + const el = document.activeElement; + if (!el || el !== event.target && !el.contains(event.target)) { + return; + } + if (el.tagName === 'SELECT') { + el.selectedIndex = Math.max(0, Math.min(el.length - 1, el.selectedIndex + Math.sign(event.deltaY))); + event.preventDefault(); + } + event.stopImmediatePropagation(); +}, { + capture: true, + passive: false, +}); function onDOMready() { if (document.readyState !== 'loading') {