From 4e49ed7c1c027628015c1a650279b934d1771386 Mon Sep 17 00:00:00 2001 From: ccd0 Date: Thu, 16 Apr 2015 22:20:24 -0700 Subject: [PATCH] More consistent checkbox focusing. --- src/Posting/Captcha.v2.coffee | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/Posting/Captcha.v2.coffee b/src/Posting/Captcha.v2.coffee index 02588d22b..4c4238b4a 100644 --- a/src/Posting/Captcha.v2.coffee +++ b/src/Posting/Captcha.v2.coffee @@ -26,10 +26,13 @@ Captcha.v2 = $.queueTask => @save false initFrame: -> - $.on window, 'focus', -> - $.queueTask -> - return unless d.hasFocus() and (checkbox = $.id 'recaptcha-anchor') - checkbox.focus() unless d.activeElement is checkbox + $.onExists d.body, '#recaptcha-anchor', true, (checkbox) -> + focus = -> + if d.hasFocus() and d.activeElement isnt checkbox + checkbox.focus() + focus() + $.on window, 'focus', -> + $.queueTask focus shouldFocus: false timeouts: {}