E-book viewer: Prevent the TAB key from causing partial scrolling in paged mode. Fixes #1571304 [page goes right when TAB is pressed](https://bugs.launchpad.net/calibre/+bug/1571304)

This commit is contained in:
Kovid Goyal 2016-04-28 07:21:33 +05:30
parent c82c1235e1
commit fab4901674
2 changed files with 7 additions and 0 deletions

Binary file not shown.

View File

@ -249,6 +249,13 @@ class PagedDisplay
this.is_full_screen_layout = (only_img or has_svg) and single_screen and document.body.scrollWidth > body_width and document.body.scrollWidth < 2 * body_width this.is_full_screen_layout = (only_img or has_svg) and single_screen and document.body.scrollWidth > body_width and document.body.scrollWidth < 2 * body_width
if is_single_page if is_single_page
this.is_full_screen_layout = true this.is_full_screen_layout = true
# Prevent the TAB key from shifting focus as it causes partial
# scrolling
document.documentElement.addEventListener('keydown', (evt) ->
if evt.keyCode == 9
evt.preventDefault()
)
ncols = document.body.scrollWidth / this.page_width ncols = document.body.scrollWidth / this.page_width
if ncols != Math.floor(ncols) and not this.is_full_screen_layout if ncols != Math.floor(ncols) and not this.is_full_screen_layout