diff --git a/src/General/Main.coffee b/src/General/Main.coffee index 727fe80f5..1e9547730 100755 --- a/src/General/Main.coffee +++ b/src/General/Main.coffee @@ -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() diff --git a/src/Posting/Captcha.v2.coffee b/src/Posting/Captcha.v2.coffee index 0c7cf19ba..8dc9c78fb 100644 --- a/src/Posting/Captcha.v2.coffee +++ b/src/Posting/Captcha.v2.coffee @@ -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}