Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
This is something any modern webapp worth its salt has in place. Normally, pressing shift
+ ?
will bring up an overlay with keyboard shortcuts. Try it on gmail or twitter.com. For the toolbar, it would be nice to be able to dismiss the tray with the esc
key and open the tray without another combination.
Should Accesskey Be Used At All? from WebAim.
From StackExchange's Meta
Comments
Comment #1
jessebeach CreditAttribution: jessebeach commentedTagging.
Comment #2
mgiffordJust saw keys.js on .NET and thought it would be worth sharing it on Drupal.org. This javascript library has some potential at least looking at the demo:
https://github.com/bitwalker/keys.js
Also there's this keyboard shortcut module that should be looked at:
https://drupal.org/project/keyboard_shortcut
Might be a D9 issue at this point though.
Comment #3
webchickYeah, I tend to agree. Could also be a contrib extension for D8.
Comment #4
mgiffordWould be totally good to test this in contrib for a variety of menus & then bring it into Core in D9 if we can get a solution that works well.
Comment #5
catchComment #6
mgiffordComment #7
nod_clearly :)
Comment #8
mgiffordComment #9
swentel CreditAttribution: swentel commentedNot sure if it belongs here, but a keyboard shortcut to trigger 'Edit' would be nice to, it's kind of tedious having to click on it before actually seeing all the pencils.
Comment #12
mgiffordComment #14
andrewmacpherson CreditAttribution: andrewmacpherson as a volunteer and at Annertech commentedJust a note that ARIA 1.1 introduces
aria-keyshortcuts
. It's intended use is to convey which keys activate a given control, while the actual keybindings are handled by javascript. It should help JS approaches like Mousetrap, or keys.js, which don't use the problematicaccesskey
attribute.See http://www.ssbbartgroup.com/blog/differences-aria-1-0-1-1-deprecations-a... for a description
Comment #21
nod_Comment #22
andrewmacpherson CreditAttribution: andrewmacpherson as a volunteer and at Annertech commentedThere is an enormous range of gotchas to implementing this, particularly involving the choice of keys, and inevitable conflicts with the web browser (and browser extensions). The more keyboard shortcuts you want, the more likely you are to run into conflicts. I've written more detail about this at #3026583: Provide a system of shortcuts or hotkeys for admin UI.
Any outcome of this issue MUST conform to WCAG success criterion 2.1.4 Character Key Shortcuts.
It's something many web apps do very badly. The motivation behind keyboard shortcuts is often focused on making things quicker for some notion of a "power user", but ends up hampering keyboard-only users.
An example is the Discourse forum software, where "/" activates a "Search in Forum" feature, but prevents Firefox's Quick Find from working. To make matters worse, early versions of Discourse also hijacked Control+F for search-in-forum, which clashed with Firefox's other find-in-page feature. (Later versions of Discourse stopped hijacking Control+F, and instead use Control+Alt+F for search-in-forum. I don't know if that's every instance of Discourse, or something configurable per site.)
I'd challenge the idea that Drupal is a "web app" at all. It's really a web page, which just happens to put an extra toolbar at the top for logged-in users. Consider a common use case: the company intranet/extranet, which several thousand employees use every week. It's a collection of pages, much like any other site. It just happens to require a log-in because it's private. Do we really think want to risk breaking browser behaviours? As a keyboard user, I'd be seriously frustrated if Firefox's Quick-Find didn't work on the company intranet pages.
Comment #23
nod_Given the related issue we should close all (toolbar at least) shortcut keys issues?
Comment #24
nod_