mirror of
https://github.com/atom/atom.git
synced 2026-02-19 02:44:29 -05:00
Correctly handle focus when shadow DOM is disabled
Signed-off-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
This commit is contained in:
@@ -93,7 +93,7 @@ TextEditorComponent = React.createClass
|
||||
className += ' is-focused' if focused
|
||||
className += ' has-selection' if hasSelection
|
||||
|
||||
div {className, style, tabIndex: -1},
|
||||
div {className, style},
|
||||
if @shouldRenderGutter()
|
||||
GutterComponent {
|
||||
ref: 'gutter', onMouseDown: @onGutterMouseDown, lineDecorations,
|
||||
|
||||
@@ -110,6 +110,11 @@ class TextEditorElement extends HTMLElement
|
||||
@focusOnAttach = true
|
||||
|
||||
blurred: (event) ->
|
||||
unless atom.config.get('editor.useShadowDOM')
|
||||
if event.relatedTarget is @component?.refs.input.getDOMNode()
|
||||
event.stopImmediatePropagation()
|
||||
return
|
||||
|
||||
@component?.blurred()
|
||||
|
||||
addGrammarScopeAttribute: ->
|
||||
|
||||
@@ -127,7 +127,7 @@ class TextEditorView extends View
|
||||
Object.defineProperty @::, 'firstRenderedScreenRow', get: -> @component.getRenderedRowRange()[0]
|
||||
Object.defineProperty @::, 'lastRenderedScreenRow', get: -> @component.getRenderedRowRange()[1]
|
||||
Object.defineProperty @::, 'active', get: -> @is(@getPaneView()?.activeView)
|
||||
Object.defineProperty @::, 'isFocused', get: -> @element is document.activeElement
|
||||
Object.defineProperty @::, 'isFocused', get: -> document.activeElement is @element or document.activeElement is @element.component?.refs.input.getDOMNode()
|
||||
Object.defineProperty @::, 'mini', get: -> @component?.props.mini
|
||||
Object.defineProperty @::, 'component', get: -> @element?.component
|
||||
|
||||
|
||||
Reference in New Issue
Block a user