-
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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
fix: stop preventing canvas pointerdown/tapend events #3207
Conversation
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/excalidraw/excalidraw/DUyYkKYSwWckh6GViMR2f2vEs3sr |
This actually doesn't work well, as it select text outside the component on canvas double-click. Will investigate. |
So, I kept not preventing default on Unfortunately, this means that clicking on canvas still retains selection that's outside the component. If we need that behavior, we'll need to manually deselect on |
// fixes pointermove causing selection of UI texts #32 | ||
event.preventDefault(); | ||
// Preventing the event above disables default behavior | ||
// of defocusing potentially focused element, which is what we | ||
// want when clicking inside the canvas. | ||
if (document.activeElement instanceof HTMLElement) { | ||
document.activeElement.blur(); | ||
} | ||
|
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.
Just need to make sure nothing breaks due to this removal else pr looks good
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.
Definitely do check. I wouldn't be surprised if something did :).
Ended up hacking the wysiwyg initialization so that our I've also made sure we select the element after submit only when confirming the submit via a button. This aligns it with production behavior without having to rely on the |
Breaks mobile. Probably related to the other |
Removing the |
Attempt to fix #3151
Also, this fixes a case where clicking on canvas doesn't deselect selection outside Excalidraw component.