Fix focusing on image in Firefox.
This commit is contained in:
parent
a0aabf6be3
commit
c72d5b4c97
@ -2,7 +2,9 @@ Main =
|
||||
init: ->
|
||||
if location.hostname is 'www.google.com'
|
||||
type = if location.pathname is '/recaptcha/api/fallback' then 'noscript' else 'v2'
|
||||
return $.ready -> Captcha[type].initFrame()
|
||||
return $.ready ->
|
||||
doc = d.documentElement
|
||||
Captcha[type].initFrame()
|
||||
|
||||
g.threads = new SimpleDict()
|
||||
g.posts = new SimpleDict()
|
||||
|
||||
@ -47,7 +47,11 @@ Captcha.v2 =
|
||||
for img in images
|
||||
img.tabIndex = 0
|
||||
if focus
|
||||
images[0].focus()
|
||||
# XXX Image is not focusable at first in Firefox; to be refactored when I figure out why.
|
||||
$.asap ->
|
||||
images[0].focus()
|
||||
d.activeElement is images[0] or not doc.contains images[0]
|
||||
, ->
|
||||
fixImages()
|
||||
new MutationObserver(fixImages).observe d.body, {childList: true, subtree: true}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user