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

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

ressa created an issue. See original summary.

ressa’s picture

Status: Active » Needs review
sandeep_k’s picture

StatusFileSize
new95.23 KB

@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.

ressa’s picture

Issue summary: View changes

Thanks! But there is no setting. I'll update the Issue Summary to make this clearer.

Does Alt + Shift + A place the cursor in the search field?

sandeep_k’s picture

Ok, Thanks @ressa for the clarification. I have tested this on Mac and this key- Cmd + Shift + A focuses on the browser search tab, not on the toolbar search.

ressa’s picture

Issue summary: View changes

Ah 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.

divya.sejekan’s picture

Assigned: Unassigned » divya.sejekan
divya.sejekan’s picture

Assigned: divya.sejekan » Unassigned
Status: Needs review » Reviewed & tested by the community
StatusFileSize
new417.59 KB
new367.23 KB

Verified 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

japerry made their first commit to this issue’s fork.

  • japerry committed b000415f on 3.x authored by ressa
    Issue #3317002: Access search field via a keyboard shortcut with...
japerry’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.