Skip to content

Commit

Permalink
Remove focus from the zoom dropdown, when a mouse is used (bug 130052…
Browse files Browse the repository at this point in the history
…5, issue 4923)

This patch fixes the referenced bugs/issues, in a way that won't interfere with keyboard users, assuming that we actually want to fix these old bugs/issues. (If not, we should close them as WONTFIX.)
  • Loading branch information
Snuffleupagus committed May 20, 2021
1 parent faf6b10 commit 6468e1d
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions web/toolbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 6468e1d

Please sign in to comment.