-
Notifications
You must be signed in to change notification settings - Fork 829
fix: focus on editors and buttons after layout shift from hidden code #7489
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
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
| * First tries to scroll the active line into view, if the cell is focused. | ||
| * If not, it scrolls the cell container into view. | ||
| */ | ||
| export function scrollCellIntoView(cellId: CellId): void { |
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.
There's a file called scrollCellIntoView.ts. Should this live there and/or renamed?
| const restoreFocus = useRestoreFocus(); | ||
|
|
||
| useEffect(() => { | ||
| if (open) { |
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.
any thoughts on this lint comment? I think we could make a handleOpen function and call this wherener setOpen()
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.
oh, the lint comment is Avoid using state and effects as an event handler. Instead, call the event handling code directly when the event occurs
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.
yea i can make a handleOpen callback
Fixes #7487
It may not (or ever) feel perfect; layout shifts will be inevitable. But this does return the focus to the selected line or button or editor after closing a temporarily shown cell (temporarily shown --> marked hidden, but was focused)