Problem/Motivation
To allow accessing the search field via a keyboard shortcut, we could use the well supported (97%) accesskey attribute, so that pressing a shortcut such as Alt + Shift + A (Firefox in Windows or Linux) would focus on the search field.
The way to activate the accesskey depends on the browser and its platform:
|
Windows |
Linux |
Mac |
| Firefox |
Alt + Shift + key |
Control + Option +
key or Control + Alt +
key
|
| Edge |
Alt + key |
Control + Option + key
|
n/a |
| Google Chrome |
Control + Option + key |
| Safari |
n/a |
Control + Option + key |
| Opera 15+ |
Alt + key |
Control + Alt + key |
| Opera 12 |
Shift + Esc opens a list of available accesskeys. Choose an item from the list by pressing
the key.
|
Proposed resolution
Define an accesskey for the search form
TODO: We could make the shortcut configurable, under for example a path like /admin/config/user-interface/admin-toolbar-search-settings ("Enable search input shortcut"), but this needs to be added.
Remaining tasks
User interface changes
API changes
Data model changes
Comments
Comment #3
ressaComment #4
sandeep_k commented@ressa, I've tested the shared MR- MR !38 mergeable on Drupal 9.5 & 10.2 versions. The patch was applied successfully but we didn't see any option in the admin-toolbar-search-settings for defining accesskey after applying the patch.
Comment #5
ressaThanks! But there is no setting. I'll update the Issue Summary to make this clearer.
Does
Alt + Shift + Aplace the cursor in the search field?Comment #6
sandeep_k commentedOk, Thanks @ressa for the clarification. I have tested this on Mac and this key-
Cmd + Shift + Afocuses on the browser search tab, not on the toolbar search.Comment #7
ressaAh yes, it depends on the OS and browser combination. I have added a table with the shortcuts in the Issue Summary, please check for your accesskey.
Comment #8
divya.sejekan commentedComment #9
divya.sejekan commentedVerified using MR!#2
@ressa - I have verified for Google Chrome and Firefox with Mac - using 'Control + Option + key' - The Search field is accessible via keyboard
Comment #12
japerry