Fixes for QR focus logic.
This commit is contained in:
parent
015efbf45e
commit
79e373382e
@ -39,6 +39,8 @@ QR =
|
|||||||
|
|
||||||
window.addEventListener 'focus', @focus, true
|
window.addEventListener 'focus', @focus, true
|
||||||
window.addEventListener 'blur', @focus, true
|
window.addEventListener 'blur', @focus, true
|
||||||
|
# We don't receive blur events from captcha iframe.
|
||||||
|
$.on d, 'click', @focus
|
||||||
|
|
||||||
Post.callbacks.push
|
Post.callbacks.push
|
||||||
name: 'Quick Reply'
|
name: 'Quick Reply'
|
||||||
@ -133,11 +135,9 @@ QR =
|
|||||||
focus: ->
|
focus: ->
|
||||||
$.queueTask ->
|
$.queueTask ->
|
||||||
return unless QR.nodes
|
return unless QR.nodes
|
||||||
focus = d.activeElement and (
|
unless $$('.goog-bubble-content > iframe').some((el) -> el.getBoundingClientRect().top >= 0)
|
||||||
QR.nodes.el.contains(d.activeElement) or
|
focus = d.activeElement and QR.nodes.el.contains(d.activeElement)
|
||||||
d.activeElement.nodeName is 'IFRAME' and /^https:\/\/www\.google\.com\/recaptcha\//.test(d.activeElement.src)
|
$[if focus then 'addClass' else 'rmClass'] QR.nodes.el, 'focus'
|
||||||
)
|
|
||||||
$[if focus then 'addClass' else 'rmClass'] QR.nodes.el, 'focus'
|
|
||||||
if chrome?
|
if chrome?
|
||||||
# XXX Stop anomalous scrolling on space/tab in captcha iframe.
|
# XXX Stop anomalous scrolling on space/tab in captcha iframe.
|
||||||
if d.activeElement and QR.nodes.el.contains(d.activeElement) and d.activeElement.nodeName is 'IFRAME'
|
if d.activeElement and QR.nodes.el.contains(d.activeElement) and d.activeElement.nodeName is 'IFRAME'
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user