use mousewheel to change focused "input[type=number], select" (#1010)
* use mousewheel to change focused "input[type=number], select"
* revert 0f394fa8
(no longer needed)
This commit is contained in:
parent
0f394fa8d8
commit
f8402a2211
|
@ -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) {
|
||||
|
|
15
js/dom.js
15
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') {
|
||||
|
|
Loading…
Reference in New Issue
Block a user