Adding visual clues that accesskey exists

From: Corey Huinker <corey(dot)huinker(at)gmail(dot)com>
To: pgsql-docs(at)lists(dot)postgresql(dot)org
Subject: Adding visual clues that accesskey exists
Date: 2023-01-13 22:07:17
Message-ID: CADkLM=dMg4cad1JJKny5ErRAuMXZcECYNznO6yFP2tJhwutdmA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs

Today I discovered that we already have accesskey support for navigation of
our documentation. And it's been there since at least 2007, according to
the mailing list archives.

I discovered this accidentally, because I was researching something and
just instinctively hit the right arrow in the vain hope that it was somehow
linked to the "Next" link.

Doing a view source on the page, I found the access keys: h = home, u = up,
n = next, p = previous. That's great, and easy to remember for English
speakers, everyone else less so. Accesskeys are primarily discovered via
screen readers, so this isn't a huge problem, but having something language
independent would be a nice touch. As far as I know, accesskeys cannot be
the arrow keys.

Accesskeys seem to have universal support (at least: Chrome, Edge, Firefox,
Safari, Opera) now according to
https://www.w3schools.com/tags/att_global_accesskey.asp but, as the page
says, they are not recommended largely because desktops and browsers tend
to reuse these keys.

I would like to make this feature more discoverable and useful. Some ideas,
in increasing order of complexity, are:

1. Add static hints to each link, so "Next" becomes "Next [n]". Fairly
simple, but visually clumsy, and it might not actually clue the user that
they need to hit ALT+n, not just "n". This chrome extension is an example
of how it might look
https://chrome.google.com/webstore/detail/display-access-keys/gpicedcgegaokienkdbbcagodgacpbpd?hl=en
. The extension itself seems stale if not completely abandoned, but the
screenshot gives a good visual representation.

2. Add the hint to the hovertext of the link. So, for example on
https://www.postgresql.org/docs/current/libpq-exec.html the Hovertext for
the "Next" link would become: "34.4 Asynchronous Command Processing
[ALT+n]". This would lead to more accidental discovery, but wouldn't alter
the existing static page appearance.

3. Add hotkey that launches an overlay which displays all available
keyboard shortcuts. A common example of this is typing '?' in gmail or any
other google web app.

4. Actually implement arrow keys with javascript, but leave the
accesskeys as-is. I'm not a front-end programmer of any great skill, but it
should be easy to capture the keydown event, filter for
ArrowUp/ArrowLeft/ArrowRight, and then either search the DOM for the anchor
with the corresponding accesskey, or rely on element ids (example:
"nav-left", "nav-up", "nav-right") to find the anchor and invoke a .click()
on it. Currently the navigation anchors do not have IDs, but adding them
for this purpose might close us off from a future use.

Thoughts?

Responses

Browse pgsql-docs by date

  From Date Subject
Next Message Noboru Saito 2023-01-14 01:00:26 archive_command was duplicated in backup.sgml
Previous Message Jonathan S. Katz 2023-01-12 21:46:02 Re: Tightening the trust auth advice