mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
Subscribe to focus events with DOM api to prevent bubbling behavior
Using React's onFocus property, focus events seemed to bubble when editors inside the editor were focused, as is the case with the autocomplete menu.
This commit is contained in:
@@ -35,7 +35,7 @@ EditorComponent = React.createClass
|
||||
className = 'editor editor-colors react'
|
||||
className += ' is-focused' if focused
|
||||
|
||||
div className: className, style: {fontSize, lineHeight, fontFamily}, tabIndex: -1, onFocus: @onFocus,
|
||||
div className: className, style: {fontSize, lineHeight, fontFamily}, tabIndex: -1,
|
||||
GutterComponent {
|
||||
editor, renderedRowRange, scrollTop, scrollHeight,
|
||||
lineHeight: lineHeightInPixels, @pendingChanges
|
||||
@@ -118,7 +118,9 @@ EditorComponent = React.createClass
|
||||
@subscribe editor.$lineHeight.changes, @requestUpdate
|
||||
|
||||
listenForDOMEvents: ->
|
||||
@getDOMNode().addEventListener 'mousewheel', @onMouseWheel
|
||||
node = @getDOMNode()
|
||||
node.addEventListener 'mousewheel', @onMouseWheel
|
||||
node.addEventListener 'focus', @onFocus # For some reason, React's built in focus events seem to bubble
|
||||
|
||||
listenForCommands: ->
|
||||
{parentView, editor, mini} = @props
|
||||
|
||||
Reference in New Issue
Block a user