Commit 1acb7dc2 by David Ormsbee

Add a short delay to calculator input focus so it doesn't jump to the bottom of…

Add a short delay to calculator input focus so it doesn't jump to the bottom of the screen when you open it.
parent 5e9fce5c
......@@ -9,11 +9,14 @@ class @Calculator
toggle: (event) ->
event.preventDefault()
$('div.calc-main').toggleClass 'open'
$('#calculator_wrapper #calculator_input').focus()
if $('.calc.closed').length
$('.calc').attr 'aria-label', 'Open Calculator'
else
$('.calc').attr 'aria-label', 'Close Calculator'
# TODO: Investigate why doing this without the timeout causes it to jump
# down to the bottom of the page. I suspect it's because it's putting the
# focus on the text field before it transitions onto the page.
setTimeout (-> $('#calculator_wrapper #calculator_input').focus()), 100
$('.calc').toggleClass 'closed'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment