-
Notifications
You must be signed in to change notification settings - Fork 53
Avoid focus loss on switching tabs #1859
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
bcotrim
left a comment
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.
Have you considered changing the TabPanel key to selectedSite.id?
I think it would also fix the issue without needing the isFirstRender lastChangeWasUser logic.
Unrelated observation: While testing keyboard navigation, I noticed that navigating to the AI Assistant tab moves focus to the input. This is pre-existing behavior from trunk, but it feels unexpected when navigating via keyboard. Might be worth a separate issue?
I did and this approach would be simpler but would it not affect setting the tabs like this, for example? studio/src/hooks/use-site-details.tsx Line 200 in 3348f90
|
You are right, on |
gcsecsey
left a comment
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 changes LGTM. I was also thinking about potential simplifications, thanks for the explanation above Kat for why the useEffect and the refs are needed.
Functionally, this works great:
CleanShot.2025-10-09.at.12.29.07.mp4
Yeah I spent some time dancing around it yesterday but could not find something simpler to make sure there is no regressions 😅 |
Related issues
Proposed Changes
This PR ensures that we don't lose focus when we use the keyboard navigation when switching between tabs.
Testing Instructions
Pre-merge Checklist