Reduce unwanted scrolling from captcha.
This commit is contained in:
parent
ff9be49d77
commit
a1921ddc4e
@ -131,19 +131,24 @@ QR =
|
|||||||
|
|
||||||
focus: ->
|
focus: ->
|
||||||
$.queueTask ->
|
$.queueTask ->
|
||||||
unless $$('.goog-bubble-content > iframe').some((el) -> el.getBoundingClientRect().top >= 0)
|
unless QR.inBubble()
|
||||||
focus = d.activeElement and QR.nodes.el.contains(d.activeElement)
|
QR.hasFocus = d.activeElement and QR.nodes.el.contains(d.activeElement)
|
||||||
$[if focus then 'addClass' else 'rmClass'] QR.nodes.el, 'focus'
|
QR.nodes.el.classList.toggle 'focus', QR.hasFocus
|
||||||
if chrome?
|
# XXX Stop unwanted scrolling due to captcha.
|
||||||
# XXX Stop anomalous scrolling on space/tab in/into captcha iframe.
|
if QR.inCaptcha()
|
||||||
if d.activeElement and QR.nodes.el.contains(d.activeElement) and d.activeElement.nodeName is 'IFRAME'
|
|
||||||
QR.scrollY = window.scrollY
|
QR.scrollY = window.scrollY
|
||||||
$.on d, 'scroll', QR.scrollLock
|
$.on d, 'scroll', QR.scrollLock
|
||||||
else
|
else
|
||||||
$.off d, 'scroll', QR.scrollLock
|
$.off d, 'scroll', QR.scrollLock
|
||||||
|
|
||||||
|
inBubble: ->
|
||||||
|
$$('.goog-bubble-content > iframe').some((el) -> el.getBoundingClientRect().bottom > 0)
|
||||||
|
|
||||||
|
inCaptcha: ->
|
||||||
|
(d.activeElement?.nodeName is 'IFRAME' and QR.nodes.el.contains(d.activeElement)) or (QR.hasFocus and QR.inBubble())
|
||||||
|
|
||||||
scrollLock: ->
|
scrollLock: ->
|
||||||
if d.activeElement and QR.nodes.el.contains(d.activeElement) and d.activeElement.nodeName is 'IFRAME'
|
if QR.inCaptcha()
|
||||||
window.scroll window.scrollX, QR.scrollY
|
window.scroll window.scrollX, QR.scrollY
|
||||||
else
|
else
|
||||||
$.off d, 'scroll', QR.scrollLock
|
$.off d, 'scroll', QR.scrollLock
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user