Stop anomalous scrolling on space/tab in captcha iframe. #231

This is seriously hacky, but probably better than ignoring the issue.
Improvements welcome.
This commit is contained in:
ccd0 2014-12-21 20:35:22 -08:00
parent d747b3de12
commit 59e11503f0

View File

@ -140,6 +140,19 @@ QR =
if $.hasClass(QR.nodes.el, 'autohide') and focus isnt $.hasClass(QR.nodes.el, 'focus')
QR.captcha[if focus then 'setup' else 'destroy']()
$[if focus then 'addClass' else 'rmClass'] QR.nodes.el, 'focus'
if chrome?
# 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'
QR.scrollY = window.scrollY
$.on d, 'scroll', QR.scrollLock
$.one d, 'mousemove wheel', -> $.off d, 'scroll', QR.scrollLock
else
$.off d, 'scroll', QR.scrollLock
scrollLock: (e) ->
if d.activeElement and QR.nodes.el.contains(d.activeElement) and d.activeElement.nodeName is 'IFRAME'
window.scroll window.scrollX, QR.scrollY
else
$.off d, 'scroll', QR.scrollLock
hide: ->
QR.captcha.destroy()
d.activeElement.blur()