Merge pull request #13408 from Snuffleupagus/zoom-click-blur

Remove focus from the zoom dropdown, when a mouse is used (bug 1300525, issue 4923)
This commit is contained in:
Tim van der Meij 2021-05-21 20:07:35 +02:00 committed by GitHub
commit 5fdb12661b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -155,6 +155,19 @@ class Toolbar {
value: this.value,
});
});
// Here we depend on browsers dispatching the "click" event *after* the
// "change" event, when the <select>-element changes.
scaleSelect.addEventListener("click", function (evt) {
const target = evt.target;
// Remove focus when an <option>-element was *clicked*, to improve the UX
// for mouse users (fixes bug 1300525 and issue 4923).
if (
this.value === self.pageScaleValue &&
target.tagName.toUpperCase() === "OPTION"
) {
this.blur();
}
});
// Suppress context menus for some controls.
scaleSelect.oncontextmenu = noContextMenuHandler;