mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-01-24 17:10:07 +08:00
fix(composer): Fix tabbing from body to subject
This commit is contained in:
parent
963d86cfd3
commit
0360c59460
2 changed files with 7 additions and 5 deletions
|
@ -131,10 +131,10 @@ class ComposerView extends React.Component
|
|||
|
||||
$el = React.findDOMNode(@refs[fieldName])
|
||||
return if document.activeElement is $el or $el.contains(document.activeElement)
|
||||
|
||||
if @refs[fieldName].focus
|
||||
@refs[fieldName].focus()
|
||||
else
|
||||
$el.select()
|
||||
$el.focus()
|
||||
|
||||
componentWillReceiveProps: (newProps) =>
|
||||
|
|
|
@ -100,12 +100,12 @@ class KeyCommandsRegion extends React.Component
|
|||
@state = {focused: false}
|
||||
@_goingout = false
|
||||
|
||||
@_in = (args...) =>
|
||||
@_in = (event) =>
|
||||
@_goingout = false
|
||||
@props.onFocusIn(args...) if @state.focused is false
|
||||
@props.onFocusIn(event) if @state.focused is false
|
||||
@setState(focused: true)
|
||||
|
||||
@_out = =>
|
||||
@_out = (event) =>
|
||||
@_goingout = true
|
||||
setTimeout =>
|
||||
return unless @_goingout
|
||||
|
@ -125,7 +125,9 @@ class KeyCommandsRegion extends React.Component
|
|||
# This prevents the strange effect of an input appearing to have focus
|
||||
# when the element receiving focus does not support selection (like a
|
||||
# div with tabIndex=-1)
|
||||
document.getSelection().empty()
|
||||
if event.relatedTarget and event.relatedTarget.tagName isnt 'INPUT'
|
||||
document.getSelection().empty()
|
||||
|
||||
@props.onFocusOut() if @state.focused is true
|
||||
@setState(focused: false)
|
||||
@_goingout = false
|
||||
|
|
Loading…
Reference in a new issue