Test
Details
Diff Detail
Event Timeline
Summary
Intent
The change replaces the browser-native accesskey="s" attribute on the quick search input field with a custom JavaScript keyboard shortcut handler. The native accesskey attribute behaves inconsistently across browsers and platforms (e.g., Alt+S on some browsers, Alt+Shift+S on others), so the goal is to provide a consistent, controlled keyboard shortcut (Alt+S / Opt+S on macOS) to focus the quick search field.
Solution
The solution has two parts:
- Removal of the accesskey attribute: The accesskey="s" attribute is removed from the quick search input element in the header template, eliminating the browser-native shortcut behavior.
- Addition of a custom keydown listener: A new keydown event listener is added in the global JavaScript file that listens for the Alt+S key combination. When detected, it prevents the default browser action and programmatically focuses the #quicksearch_top input element. This provides a unified shortcut experience (Alt+S on Windows/Linux, Opt+S on macOS) regardless of browser-specific accesskey modifier differences.
| js/global.js | ||
|---|---|---|
| 268 | event.which is deprecated and removed from web standards. Replace String.fromCharCode(event.which) === 'S' with event.code === 'KeyS'. Using event.code is also more reliable for keyboard shortcuts since it references the physical key position and won't be affected by Alt/Opt producing alternate characters on certain keyboard layouts (e.g., on macOS, Opt+S produces 'ß' in some layouts, which would cause event.key to not match 's'). | |