Skip to content

Accessibility issues with Tabbed and Tab extensions #2400

Description

@myasonik

Description

The rendered tabs are missing a few things needed to create an accessible experience.

Spec example implementation can be found in the APG

The needed changes:

  • Focus state for tabs

  • The DOM needs to be considerably rewritten

    The basic structure should be:

    <div role="tab">
      <div role="tablist">
        <button type="button" role="tab" id="tab-1" aria-selected={true|false} aria-controls="tabpanel-1" tabindex="0">
          Tab 1
        </button>
        <button type="button" role="tab" id="tab-2" aria-selected={true|false} aria-controls="tabpanel-2" tabindex="-1">
          Tab 1
        </button>
      </div>
      <div role="tabpanel" id="tabpanel-1" tabindex="0" aria-labelledby="tab-1">{content}</div>
      <div role="tabpanel" id="tabpanel-2" tabindex="0" aria-labelledby="tab-2">{content}</div>
    </div>
    

Not needed per spec but best practice for unknown tab content:

  • Add tabindex="0" to tabpanels

Minimal Reproduction

  1. Render tabs (any example on Tabbed or Tab)
  2. Try to navigate with any screen reader (tabs are not identified as tabs and are difficult to navigate)

Version(s) & System Info

  • Operating System: MacOS
  • Python Version:
  • Package Version: 10.8.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions