-
Notifications
You must be signed in to change notification settings - Fork 641
Breadcrumbs: Fix esc button not being able to focus on the menubuttonRef #6854
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
Conversation
🦋 Changeset detectedLatest commit: c112cf2 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes an issue where the escape button couldn't properly focus on the menu button in the Breadcrumbs component. The problem was that the Details component was preventing the ref from being properly set on the button element.
- Updated ref type from
HTMLElementtoHTMLButtonElementfor better type safety - Implemented a workaround to find the correct summary element using DOM querying instead of direct ref assignment
- Removed the ref prop from the IconButton since the ref is now set via DOM querying
|
👋 Hi, this pull request contains changes to the source code that github/github depends on. If you are GitHub staff, we recommend testing these changes with github/github using the integration workflow. Thanks! |
Fixes an issue where the ESC button could not focus on the menubutton reference in Breadcrumbs.
size-limit report 📦
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the reason the ref is getting dumped is because the IconButton does not include the forwardedRef if the button has an external tooltip. Can we work around this instead of hacking a querySelector? options:
- put the ref on the tooltip in Breadcrumbs.tsx, like the IconButton does
- use the IconButton api to render the tooltip, instead of rendering it in Breadcrumbs.tsx
|
Hi, So this is the route I first went through to fix this issue.
Maybe we could pair on this tomorrow and find a different solution? |
Closes ##6752
Changelog
The details component seems to swallow the ref value here for some reason. The button ref really doesn't get set here. There seems no issue with the IconButton ref as I initially assumed. I had to workaround to find the right
summaryelement for this feature to work well.Before
Screen.Recording.2025-09-15.at.11.23.12.pm.mov
After
Screen.Recording.2025-09-15.at.11.41.26.pm.mov
New
Changed
Removed
Rollout strategy
Testing & Reviewing
Merge checklist