Skip to content

fix: prevent useTooltipTrigger from setting tabIndex #8622

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

Merged
merged 3 commits into from
Aug 4, 2025

Conversation

abeljohn
Copy link
Contributor

Closes #8556

✅ 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:

🧢 Your Project:

Copy link
Member

@snowystinger snowystinger left a comment

Choose a reason for hiding this comment

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

property added in 53d8ed2

wasn't able to think of any counter example, but added some tests

})
onKeyDown: onPressStart
}),
tabIndex: undefined
Copy link
Member

Choose a reason for hiding this comment

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

why is the undefined needed here at all?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the focusableProps here include a tabIndex, which then gets passed into FocusableContext. for the component consuming that context via useFocusable, the props from context (interactionProps) take precedence over the tabIndex determined by excludeFromTabOrder/isDisabled

another potential fix is to have useFocusable's calculated tabIndex take precedence over the props coming from the context, but that may be a riskier change

Copy link
Member

Choose a reason for hiding this comment

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

Ok. I'm actually unsure why useTooltipTrigger calls useFocusable at all, since it is meant to pass the trigger props down to an element that already calls that (e.g. button). But looks like it's been there for 5+ years 🤷

@devongovett devongovett added this pull request to the merge queue Aug 4, 2025
Merged via the queue into adobe:main with commit 2ee02a0 Aug 4, 2025
31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

excludeFromTabOrder is ignored on children of TooltipTrigger
3 participants