mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-09-09 14:16:02 +08:00
fix(onboarding): Focus first field when showing settings #1696
This commit is contained in:
parent
7ee762a202
commit
2d279eeb05
1 changed files with 13 additions and 0 deletions
|
@ -81,6 +81,19 @@ class AccountSettingsPage extends React.Component
|
|||
</form>
|
||||
</div>
|
||||
|
||||
componentDidMount: =>
|
||||
@_applyFocus()
|
||||
|
||||
componentDidUpdate: =>
|
||||
@_applyFocus()
|
||||
|
||||
_applyFocus: =>
|
||||
firstInput = React.findDOMNode(@).querySelector('input')
|
||||
anyInputFocused = document.activeElement and document.activeElement.nodeName is 'INPUT'
|
||||
|
||||
if firstInput and not anyInputFocused
|
||||
firstInput.focus()
|
||||
|
||||
_onSettingsChanged: (event) =>
|
||||
# NOTE: This code is largely duplicated in _onValueChanged. TODO Fix!
|
||||
{field, format} = event.target.dataset
|
||||
|
|
Loading…
Add table
Reference in a new issue