This repository was archived by the owner on Mar 3, 2023. It is now read-only.
Repository navigation
Fix unresponsive text input after double-clicking - #2522
Merged
Merged
Conversation
added 2 commits
June 5, 2014 17:22
Contributor
|
Maybe it's got something to do with the missing overlayer in the react editor? You're interacting directly with the text node, so maybe it's trying to focus on that text node. |
Contributor
There was a problem hiding this comment.
It's event rather than e.
Author
|
I think you're right @benogle, we were returning false for the overlayer's mousedown event https://github.com/atom/atom/blob/cj-fix-react-double-click-bug/src/editor-view.coffee#L373 |
probablycorey
pushed a commit
that referenced
this pull request
Jun 6, 2014
Fix unresponsive text input after double-clicking
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This fixes the bug, but it raises some concerns as well. I'll go though how I debugged this in case it helps shed some more light on the problem.
TL;DR it is fixed but I don't know what was causing it.
Atom handles text input using a hidden input field. I suspected that the problem was this hidden input field was losing focus, so I added
setInterval((-> console.log document.activeElement), 1000)to my~/.atom/init.coffeefile. This logs if the hidden input loses focus. After double clicking around awhile the hidden input would lose focus and the body element would become focused.I noticed the mouseDown event was being caught in an unknown parent of EditorComponent and would focus the body element. When the dev tools are used to look at what is bound to the mouseDown event you can see a react component is bound (expected) and a jquery object (unexpected):
I solved this by making sure the mouseDown event in EditorComponent doesn't bubble. But I still wanted to know what event handler was causing this problem. I searched in Atom Core for mousedown handlers but none of those caused the problem. This led me to believe the problem was in a package, so I ran Atom in safe mode (
atom --safe), which will start Atom with out any downloaded packages. In safe mode I could still recreate the problem. But the jquery mousedown event was no longer in the dev tools event viewer. I found out it was the color-viewer package that was adding the mousedown event handler to body, but removing that package didn't fix the problem.So I'm left wondering what the problem was and why it only happened with the react editor.
Closes #2459