Skip to content

Commit 46a6a09

Browse files
committed
Remove focus from the zoom dropdown, when a mouse is used (bug 1300525, 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.)
1 parent faf6b10 commit 46a6a09

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

web/toolbar.js

+13
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,19 @@ class Toolbar {
155155
value: this.value,
156156
});
157157
});
158+
// Here we depend on browsers dispatching the "click" event *after* the
159+
// "change" event, when the <select>-element changes.
160+
scaleSelect.addEventListener("click", function (evt) {
161+
const target = evt.target;
162+
// Remove focus upon clicking of an <option>-element, to improve the UX
163+
// for mouse users (fixes bug 1300525 and issue 4923).
164+
if (
165+
this.value === self.pageScaleValue &&
166+
target.tagName.toUpperCase() === "OPTION"
167+
) {
168+
this.blur();
169+
}
170+
});
158171
// Suppress context menus for some controls.
159172
scaleSelect.oncontextmenu = noContextMenuHandler;
160173

0 commit comments

Comments
 (0)