-
-
Notifications
You must be signed in to change notification settings - Fork 136
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
Navigating away from a focused CodeMirror blocks all inputs on the page #677
Comments
2024-07-23.01.46.02.mp4@Hypnosphi After testing, I can edit. I’m not sure if I misunderstood. |
@jaywcjlove it's because the CodeMirror gets blurred when you click "TextArea" link. To reproduce, please use the browser "back" button above |
I reproduced the error. I think if you need to put the |
@jaywcjlove No, it blocks absolutely all inputs, controlled or uncontrolled, and even the ones not rendered by React: https://codesandbox.io/p/devbox/react-codemirror-breaks-input-5sl4fw |
Also noticed this happening here |
1 similar comment
Also noticed this happening here |
From what I've seen this happens when the codemirror is in focus and it happens to someone who removes the codemirror from the DOM. Ex radix Tabs |
Let me know if you find a workaround like performing some cleanup on unmounting codemirror |
I've seen this too. It seems to be dependent on how the component is managed in React code. |
More specific observation
Screen.Recording.2024-10-17.at.3.24.05.PM.mov |
We have seem intermittent issues without portals or drawers, but in order to reliably see the issue, here's a reproducible version: To see the issue,
|
Looking at the react-codemirror code, I see a prop
should be something like:
I don't know if this will solve the issue, but generally, updating state based on current state should be done functionally since the latest state is not updated immediately. |
Video example of Screen.Recording.2024-10-21.at.4.18.01.PM-1.mov |
I fixed the codesandbox link: |
@jazeee Contributions via PR to solve this issue are warmly welcomed! |
@jazeee I couldn’t reproduce this error in Next.js, and I still haven’t figured out the exact cause of the issue. |
@jaywcjlove yeah, it is a tricky bug. Here is the code sample I was able to repro in. |
Example on CodeSandbox: https://codesandbox.io/p/devbox/react-codemirror-breaks-input-5sl4fw
To reproduce, click on "CodeMirror" link in the preview and then navigate back using the preview browser controls (that is, without blurring the CodeMirror element). After that, no input in the textarea is possible
The text was updated successfully, but these errors were encountered: