Make reload button reachable by arrow keys.
This commit is contained in:
parent
7912dde878
commit
8bea005b3f
@ -40,15 +40,16 @@ Captcha.fixes =
|
|||||||
|
|
||||||
keybinds: (e) ->
|
keybinds: (e) ->
|
||||||
return unless @images and doc.contains(@images[0]) and d.activeElement
|
return unless @images and doc.contains(@images[0]) and d.activeElement
|
||||||
|
reload = $.id 'recaptcha-reload-button'
|
||||||
|
verify = $.id 'recaptcha-verify-button'
|
||||||
x = @images.indexOf d.activeElement
|
x = @images.indexOf d.activeElement
|
||||||
if x < 0
|
if x < 0
|
||||||
return unless $('.rc-controls').contains d.activeElement
|
return unless $('.rc-controls').contains d.activeElement
|
||||||
x = 11
|
x = if d.activeElement is verify then 11 else 9
|
||||||
return unless dx = {38: 9, 40: 3, 37: 11, 39: 1}[e.keyCode]
|
return unless dx = {38: 9, 40: 3, 37: 11, 39: 1}[e.keyCode] # Up, Down, Left, Right
|
||||||
if x is 11 and dx is 11 # left from buttons
|
x = (x + dx) % 12
|
||||||
x = 8
|
if x is 10
|
||||||
else
|
x = if dx is 11 then 9 else 11
|
||||||
x = (x + dx) % 12
|
(@images[x] or {9: reload, 11: verify}[x]).focus()
|
||||||
(@images[x] or $.id 'recaptcha-verify-button').focus()
|
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
e.stopPropagation()
|
e.stopPropagation()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user