Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tabs: Make tabs navigable by arrow keys and remove tab navigation #652

Open
joelzwarrington opened this issue Sep 15, 2021 · 1 comment
Open
Assignees
Labels
accessibility Accessibility fixes or enhancements good first issue hacktoberfest Some SPOOKY issues for Hacktoberfest.

Comments

@joelzwarrington
Copy link
Contributor

joelzwarrington commented Sep 15, 2021

The Tab component's accessibility can be improved to use expected keyboard behaviour.

Unlike a same-page link, a tab does not move the user to the associated section/panel of content. It just reveals the content visually. This is advantageous to sighted users (including sighted screen reader users) who wish to flit between different sections without having to wade back up the page each time they want to choose a new one.

This comes with an unfortunate side effect: If the user wishes to move to a section by keyboard and interact with its internal content, they have to step through any tabs to the right of the current tab, which are in focus order.

This problem is solved by delegating tab selection to arrow keys. The user is able to select and activate tabs using the arrow keys, while the Tab key is preserved for focusing contents within and below the active tab panel. To put it another way: Tab is not for tabs, which I concede is a bit confusing. I wish the key and the control had different names, but alas.

It's equally important that pressing Shift + Tab returns the user to the selected tab. This is all possible by giving each tab but the selected tab tabindex="-1", which removes the inactive tabs from focus order but allows focus via a script. In the following example, the second tab is the selected tab, as denoted by the aria-selected state being set to true.

Expected Behaviour

  • While focused on the tab selector, arrow keys which navigate between the sections:
  • While focused on the tab selector, tabbing will focus on the content of the tab
  • While focused on the content of a tab, tabbing will focus on the tab selector
@joelzwarrington joelzwarrington added hacktoberfest Some SPOOKY issues for Hacktoberfest. accessibility Accessibility fixes or enhancements good first issue labels Sep 15, 2021
@eddysims eddysims changed the title Make tabs navigable by arrow keys and remove tab navigation Tabs: Make tabs navigable by arrow keys and remove tab navigation Sep 27, 2021
@vartika06
Copy link

Hi @joelwarrington-jobber
I would like to work on this one. Is it possible to assign it to me?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accessibility Accessibility fixes or enhancements good first issue hacktoberfest Some SPOOKY issues for Hacktoberfest.
Development

No branches or pull requests

2 participants