gutenberg icon indicating copy to clipboard operation
gutenberg copied to clipboard

Can't navigate to undo/redo group in Docked Toolbar via keyboard

Open ephox-mogran opened this issue 9 years ago • 4 comments

Issue Overview

Pressing Alt+F10 focuses the newly docked toolbar, but I'm unsure how to navigate with the keyboard to insert block, undo and redo. Pressing Shift+Tab just cycles through the formatting toolbar.

If I focus the insert block button using the mouse, then Tab gets me to the formatting toolbar, but Shift+Tab doesn't go back to the insert block group.

Steps to Reproduce (for bugs)

  1. Press Alt+F10 to focus the toolbar
  2. Try pressing Left or Shift+Tab to go backwards in the toolbar

Expected Behavior

I should be able to navigate to the other buttons to the left.

Current Behavior

It only cycles through the formatting section of the toolbar.

Possible Solution

@youknowriad has suggested that we may just need to move NavigableMenu up the hierarchy

Related Issues and/or PRs

Todos

  • [ ] Tests
  • [ ] Documentation

ephox-mogran avatar Oct 27 '17 19:10 ephox-mogran

@afercia how would you expect to do this with the keyboard? Or isn't it important?

ephox-mogran avatar Oct 27 '17 19:10 ephox-mogran

Yep I've noticed that since a few days tabbing or arrowing within a (formerly) block toolbar (now docked toolbar) loops through the controls within the toolbar and doesn't allow to tab away from there.

Tabbing shouldn't be constrained within a toolbar. Only arrowing should.

One more thing to consider is whether or not we want to meet the ARIA interaction model for toolbars. In that model, toolbars have just one Tab stop. Navigation through the toolbar controls happens with arrow keys only,

This would require big changes to the rendered markup, as now the docked toolbars are part of a "global" toolbar that starts from the Inserter button and ends with the ellipsis one.

To follow the ARIA model, this whole section should have a role="toolbar" and all the UI controls inside the toolbar should be direct children of the toolbar in the accessibility tree. This means using role="presentation" on all the HTML elements that are in between the toolbar and the controls.

TL:DR W3C example: https://www.w3.org/TR/wai-aria-practices/examples/toolbar/toolbar.html Interaction model details, roles, etc: https://www.w3.org/TR/wai-aria-practices/#toolbar Related issue: https://github.com/WordPress/gutenberg/issues/632 (this was pre-docked toolbar but still applies as the role="toolbar" is the only wah to make keyboard events work when screen readers are in "browse mode")

afercia avatar Oct 27 '17 21:10 afercia

Tabbing shouldn't be constrained within a toolbar. Only arrowing should.

Should this be a generic behavior for all "NavigableMenu" components?

youknowriad avatar Oct 30 '17 08:10 youknowriad

Was thinking (and played a bit with it) to propose to abstract a bit NavigableMenu to make it a generic component for keyboard navigation. Its usage wouldn't be limited to menus but to all UI that need Tab or arrow keys navigation, e.g. toolbars.

Should this be a generic behavior for all "NavigableMenu" components?

Not always, depends on the component. For example, the inserter needs tabbing to be constrained.

What I've tried:

  • add a third value for orientation: "spatial" to use all the 4 arrow keys and tab. For example, th einserter would need up+left for previous and down+right for next.
  • add a 'cycle' prop to control whether to loop through items or not
  • also tried both 'cycle' and constrainTabbing props to control arrows looping ant Tab looping separately

afercia avatar Oct 30 '17 09:10 afercia