Skip to content

Conversation

@abeljohn
Copy link
Contributor

@abeljohn abeljohn commented Feb 3, 2026

Closes #9584

✅ Pull Request Checklist:

  • Included link to corresponding React Spectrum GitHub Issue.
  • Added/updated unit tests and storybook for this change (for new code or code which already has tests).
  • Filled out test instructions.
  • Updated documentation (if it already exists for this component).
  • Looked at the Accessibility Practices for this feature - Aria Practices

📝 Test Instructions:

Set Tabs' selectedKey to null

@abeljohn abeljohn force-pushed the fix-tabs-null-selectedkey branch from e7fc400 to 6eac44d Compare February 3, 2026 06:22
// Ensure a tab is always selected (in case no selected key was specified or if selected item was deleted from collection)
let selectedKey = currentSelectedKey;
if (props.selectedKey == null && (selectionManager.isEmpty || selectedKey == null || !collection.getItem(selectedKey))) {
if (props.selectedKey === undefined && (selectionManager.isEmpty || selectedKey == null || !collection.getItem(selectedKey))) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

my understanding is that we only want to do this in the uncontrolled case, seeing as we don't do this when props.selectedKey is a non-null Key

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.

Tabs infinitely rerenders when selectedKey is null

1 participant