fix(onboarding): Focus first field when showing settings #1696

This commit is contained in:
Ben Gotow 2016-03-18 14:03:37 -07:00
parent 7ee762a202
commit 2d279eeb05

View file

@ -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