mirror of
https://github.com/atom/atom.git
synced 2026-01-24 06:18:03 -05:00
Bug fix: Editor retains focus when clicked while already focused
I couldn't find a way to test this really. It's some interaction between focusout and focus events. When the hidden input has focus and then we call focus on the editor, the handling of the focusout event away from input was trigerring a call to focus on the editor, which didn't seem to trigger the handler that shifted it back to the hidden input. Here I only focus the editor if something *outside* of the editor was de-focused. So focusing the editor when the input is focused is ignored, and focus is gracefully returned back to the input.
This commit is contained in:
@@ -33,7 +33,9 @@ class RootView extends Template
|
||||
@on 'toggle-file-finder', => @toggleFileFinder()
|
||||
|
||||
@on 'focusout', (e) =>
|
||||
@editor.focus() unless e.target is @editor.find('input')[0]
|
||||
# if anything but the editor and its input loses focus, restore focus to the editor
|
||||
unless $(e.target).closest('.editor').length
|
||||
@editor.focus()
|
||||
|
||||
createProject: (url) ->
|
||||
if url
|
||||
|
||||
Reference in New Issue
Block a user