Skip to content

<Tabs> should be insensitive to ordering mismatches #4465

@slorber

Description

@slorber

🐛 Bug Report

<Tabs
  values={[
    {label: 'Android', value: 'android'},
    {label: 'iOS', value: 'ios'},
    {label: 'Web', value: 'web'},
  ]}>
  <TabItem value="web">Web</TabItem>
  <TabItem value="android">Android</TabItem>
  <TabItem value="ios">iOS</TabItem>
</Tabs>

When the values array is not in the exact same order as the <TabItems>, we end up with a really weird experience:

Clicking on Android focus the Web tab (ie it does not focus the tab you click on)

image

Reported here: facebook/react-native-website#2548
This is likely a regression of older accessibility refactor using refs, we were not sensitive to this issue before.

I think we should make the tabs non-sensitive again, using values as the source of truth, and eventually add a warning so that users avoid ordering mismatch.

cc @lex111 @Simek

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugAn error in the Docusaurus core causing instability or issues with its execution

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions