Skip to content

Conversation

@git-nandor
Copy link
Contributor

INSTUI-4878

Summary

The component was hardcoding tabindex="0" on all panels.
According to WCAG guidelines, this should only be set when panels don't contain focusable elements, otherwise it creates unnecessary tab stops.
Adds optional tabIndex prop to Tabs.Panel to allow proper WCAG-compliant focus management.
Developers can now set tabIndex={-1} for panels with focusable content or tabIndex={null} to omit the attribute entirely.

Changes

  • Adds optional tabIndex prop to Tabs.Panel to allow proper WCAG-compliant focus management
  • Added tabIndex?: number | null prop (defaults to 0 for backwards compatibility)
  • Updated README with usage examples and WCAG guidance

Test plan

On the documentation page, verify the correct focus handling of Tabs.Panel.

Co-Authored-By: 🤖 Claude

@git-nandor git-nandor self-assigned this Dec 16, 2025
@github-actions
Copy link

github-actions bot commented Dec 16, 2025

PR Preview Action v1.6.3

🚀 View preview at
https://instructure.design/pr-preview/pr-2312/

Built to branch gh-pages at 2025-12-23 15:16 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@git-nandor git-nandor marked this pull request as ready for review December 16, 2025 14:42
@git-nandor git-nandor force-pushed the INSTUI-4878_tabpanel_focus_issue branch from 313b5b4 to dbdb065 Compare December 16, 2025 15:12
@git-nandor git-nandor force-pushed the INSTUI-4878_tabpanel_focus_issue branch from dbdb065 to 8c4e5cf Compare December 19, 2025 08:34
@git-nandor git-nandor requested review from balzss and removed request for matyasf December 19, 2025 09:06
@balzss balzss force-pushed the INSTUI-4878_tabpanel_focus_issue branch from 8c4e5cf to c85cc9f Compare December 23, 2025 11:51
@balzss balzss requested a review from ToMESSKa December 23, 2025 11:52
Copy link
Contributor

@balzss balzss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the code looks good, I've slightly updated the documentation wording and some of the examples to adhere to our own recommendation about tabIndex

</Tabs.Panel>
<Tabs.Panel renderTitle="Disabled Tab" isDisabled>
{lorem.paragraphs()}
<Tabs.Panel renderTitle="Disabled Tab" isDisabled tabIndex={0}>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the point of setting the tabIndex to 0 when the panel is disabled? It will never be 0.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you are right, fixed it

Comment on lines 253 to 289
</Tabs.Panel>
<Tabs.Panel id="tabB" renderTitle="Disabled Tab" isDisabled>
{lorem.paragraphs()}
<Tabs.Panel id="tabB" renderTitle="Disabled Tab" isDisabled tabIndex={0}>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the point of setting the tabIndex to 0 when the panel is disabled? It will never be 0.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you are right, fixed it

Comment on lines 32 to 34
</Tabs.Panel>
<Tabs.Panel id="tabB" renderTitle="Disabled Tab" isDisabled>
{lorem.paragraphs()}
<Tabs.Panel id="tabB" renderTitle="Disabled Tab" isDisabled tabIndex={0}>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the point of setting the tabIndex to 0 when the panel is disabled? It will never be 0.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you are right, fixed it

@balzss balzss force-pushed the INSTUI-4878_tabpanel_focus_issue branch from c85cc9f to c2b8253 Compare December 23, 2025 15:11
…s control (defaults to 0 for backward compatibility)
@balzss balzss requested a review from ToMESSKa December 23, 2025 15:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants