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

[a11y]: dismissible tab has focus handling issue after activation; also last two items should not be dismissible #15919

Open
1 of 2 tasks
mbgower opened this issue Mar 7, 2024 · 2 comments

Comments

@mbgower
Copy link

mbgower commented Mar 7, 2024

Package

@carbon/react

Browser

Chrome

Operating System

MacOS

Package version

https://react.carbondesignsystem.com/?path=/story/components-tabs--dismissable-with-icons#storybook-preview-wrapper

React version

No response

Automated testing tool and ruleset

n/a

Assistive technology

No response

Description

When pressing Delete to dismiss a tab item from the Dismissible tab (with or without icons) https://react.carbondesignsystem.com/?path=/story/components-tabs--dismissable-with-icons#storybook-preview-wrapper,
the focus is lost from all items.
Expectation is that focus should be place on the prior item in the list or somewhere else on the page, but there is nothing that takes focus.

WCAG 2.1 Violation

Focs Visible

Reproduction/example

https://react.carbondesignsystem.com/?path=/story/components-tabs--dismissable-with-icons#storybook-preview-wrapper

Steps to reproduce

  1. Open https://react.carbondesignsystem.com/?path=/story/components-tabs--dismissable-with-icons#storybook-preview-wrapper or https://react.carbondesignsystem.com/?path=/story/components-tabs--dismissable
  2. Navigate to the main area by keyboard (I suggest you tab once, Enter on Skip to canvas and tab a couple more times)
  3. Once focus is on the tab list, use the arrow key to move to an item other than the first one
  4. Press delete; the item disappears, and focus also disappears (the focus being placed elsewhere is expected behaviour).
  5. Press Tab once. The Reset button now has focus

The focus handling has a few considerations: if I delete the first item in the list, where should the focus go? If I delete the final item? I believe the interactions decided on is that the focus will always be placed on the preceding item, and when there is not a preceding tab item, the focus would be placed on the next tab item.
A second issue in this implementation is that there should never be a case where the final item is deleted. IMO, the dismiss mechanism should cease to exist (or get disabled) once there are only 2 tab items left, as according to the documentation, tabs "always contain at least two items".

Code of Conduct

@alisonjoseph
Copy link
Member

alisonjoseph commented Apr 4, 2024

The focus issues should be resolved with #16033

A second issue in this implementation is that there should never be a case where the final item is deleted. IMO, the dismiss mechanism should cease to exist (or get disabled) once there are only 2 tab items left, as according to the documentation, tabs "always contain at least two items".

@carbon-design-system/developers @carbon-design-system/design Is this something we want to control, or leave it up to the user when implementing the dismissable tab?

@alisonjoseph alisonjoseph moved this from ⏱ Backlog to 🪆 Needs Refined in Design System Apr 4, 2024
@kingtraceyj
Copy link
Member

we should probably update the number of tabs guidelines. i think that 2 tab guideline was before we had dismissible tabs and was never updated.

there are use cases i've seen when there is only one dismissible tab—mostly around saved searches but it's a common interaction in browsers when there is only 1 tab open.

i can't think of any use cases to have only 1 tab for non-dismissible tabs though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: 🪆 Needs Refined
Development

No branches or pull requests

5 participants