0

TL;DR: Is there a recommended best practice to make keyboard navigation through an undirected graph accessible for visually impaired people?

I am currently working on an HTML based application that displays an undirected graph of buttons. Buttons are all contained in one div container. The paths that connect buttons visually are in a different container and are not relevant here, but the information that they transport about adjacency, of course. Each button can be used to trigger some action. I now wonder how I could make keyboard navigation accessible for visually impaired people.

Without any special treatment, a user would simply tab through all buttons. Information about adjacent buttons could, of course, be given via ARIA descriptions, but direct navigation to a specific neighboring button would not be possible. One would need to remember the label of the button and tab until it's found. That doesn't feel too user friendly.

I have browsed common ARIA patterns and ARIA roles, but none does really seem to fit my purpose - I'd end up dynamically creating and restructuring treeviews or (tab)lists or worse with all kind of pitfalls probably.

Currently, my best idea is to simply use the application role for the buttons' div container with some custom keyboard commands to navigate. Navigation instructions would be announced via screen readers, of course. This could for instance mean: tab to enter/exit the application div and focus the entry button/previously selected button, arrow keys to cycle through the currently focused button's neighbors and the button itself announcing each label, and space/enter on the button would trigger the button's action and space/enter on a neighbor would make this the newly selected button.

That sounds feasible to me, but I wonder if there already is some best practice for this problem that I did not find myself.

Oliver Tacke
  • 332
  • 4
  • 12
  • 1
    I don’t believe I’ve seen any best practice for an _undirected_ graph. I’ve seen good examples of trees like organizational charts. Applying the _composite widget_ pattern with a single tab stop is a great idea. I believe to perceive a graph it’s most important to easily discover the edges? Is that what you’re referring to as neighbours, all nodes that are connected to the current button? I believe that it’s fine to use Space for selection, and Enter for actions. – Andy Jan 16 '23 at 15:08
  • @Andy Thanks for your comment! I had never heard of the `composite` role before, but [MDN ](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/composite_role) suggests it should not be used. The graph is like a map that the user can walk on from node to node (and neighbors are adjacent nodes to a node, yes). Think of it as the map of Super Mario World where users may need to clear a stage (node) to continue. That graph can have cycles, so a tree doesn't work. Having different actions for `Space` (e.g. move) and `Enter` (e.g. move and enter) might in fact work. Thanks again! – Oliver Tacke Jan 16 '23 at 17:58
  • 1
    I’m not suggesting to actually assign the `composite` role, as it is an abstract role and *must not* be assigned. But it provides you with a name for what you are doing with focus management, which is a great idea. The [ARIA standard for `composite`](https://w3c.github.io/aria/#composite) explains what it does: It indicates that the whole widget has a single tab stop and requires other means of navigation inside, for example arrow keys. Unfortunately no subclass role of `composite` applies to your case. – Andy Jan 17 '23 at 08:39
  • 1
    See also [APG’s Keyboard navigation inside components](https://www.w3.org/WAI/ARIA/apg/practices/keyboard-interface/#x6-6-keyboard-navigation-inside-components) – Andy Jan 17 '23 at 08:40
  • @Andy Thank you so much for your input! And yes, having a single tab stop and arrow keys for navigation would in fact be nice - and if there's some aria means to ensure that's clear, all the better, Thanks for that learning opportunity! – Oliver Tacke Jan 17 '23 at 12:04

0 Answers0