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
Prevent pressing escape when editing document name to bubble up to the editor #3725
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Ignored Deployment
|
7f819e4
to
6ab14c7
Compare
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.
lg! approving modulo one minor comment on focus :P
// revert to original name instantly so that when we blur we don't | ||
// trigger a save with the new one | ||
setState((prev) => ({ ...prev, name: null })) | ||
inputRef.current?.blur() | ||
editor.getContainer().focus() |
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.
(i've been staring at focus too long). i don't think we need this line - looks like just doing stopEventPropagation will do the trick 👍
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.
I tried it, but then the second escape did not switch back to the select tool 🤷 Keyboard shortcuts worked, but escape didn't.
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.
ahh interesting interesting, didn't realize that! can you add a note that that's what the focus does? definitely we'll forget why we put that there later :)
lgtm! |
This prevents pressing escape to bubble to up to editor when editing document names. Prevents the current tool to change back to select tool.
Before
Pressing escape when editing the name stops the editing, but also switches from hand tool to select tool.
CleanShot.2024-05-08.at.15.37.33.mp4
After
We no longer switch to hand tool when we press escape the first time. The second time it still works though.
CleanShot.2024-05-08.at.15.51.09.mp4
@mimecuvalo happy to wait for your focus management PR to get merged, then update accordingly by using
editor.focus()
.Change Type
sdk
— Changes the tldraw SDKdotcom
— Changes the tldraw.com web appdocs
— Changes to the documentation, examples, or templates.vs code
— Changes to the vscode plugininternal
— Does not affect user-facing stuffbugfix
— Bug fixfeature
— New featureimprovement
— Improving existing featureschore
— Updating dependencies, other boring stuffgalaxy brain
— Architectural changestests
— Changes to any test codetools
— Changes to infrastructure, CI, internal scripts, debugging tools, etc.dunno
— I don't knowTest Plan
Release Notes