Fix errors reported in the console for listeners that use preventDefault()

This commit is contained in:
Kovid Goyal 2019-08-01 08:32:38 +05:30
parent 84c8544e14
commit cd64459718
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 9 additions and 6 deletions

View File

@ -97,9 +97,9 @@ class IframeBoss:
window.onerror = self.onerror
window.addEventListener('scroll', debounce(self.onscroll, 1000))
window.addEventListener('resize', debounce(self.onresize, 500))
window.addEventListener('wheel', self.onwheel)
window.addEventListener('keydown', self.onkeydown)
document.documentElement.addEventListener('contextmenu', self.oncontextmenu)
window.addEventListener('wheel', self.onwheel, {'passive': False})
window.addEventListener('keydown', self.onkeydown, {'passive': False})
document.documentElement.addEventListener('contextmenu', self.oncontextmenu, {'passive': False})
self.color_scheme = data.color_scheme
create_touch_handlers()

View File

@ -212,9 +212,12 @@ def layout(is_single_page):
is_full_screen_layout = True
# Prevent the TAB key from shifting focus as it causes partial scrolling
document.documentElement.addEventListener('keydown', def (evt):
if get_key(evt) is 'tab':
evt.preventDefault()
document.documentElement.addEventListener(
'keydown',
def (evt):
if get_key(evt) is 'tab':
evt.preventDefault()
, {'passive': False}
)
# Some browser engine, WebKit at least, adjust column widths to please