mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Workaround for bug on Chrome on Android that made typing in the viewer preferences impossible
Chrome resizes the viewport when the on screen keyboard is opened. This causes the overlay to be closed. Hopefully, it will be fixed soon. See https://bugs.chromium.org/p/chromium/issues/detail?id=404315
This commit is contained in:
parent
5b3d7c04cf
commit
de6e5ec8d6
@ -349,6 +349,10 @@ class Overlay:
|
|||||||
def container(self):
|
def container(self):
|
||||||
return document.getElementById('book-overlay')
|
return document.getElementById('book-overlay')
|
||||||
|
|
||||||
|
@property
|
||||||
|
def is_visible(self):
|
||||||
|
return self.container.style.display is not 'none'
|
||||||
|
|
||||||
def container_clicked(self, evt):
|
def container_clicked(self, evt):
|
||||||
if self.panels.length and jstype(self.panels[-1].on_container_click) is 'function':
|
if self.panels.length and jstype(self.panels[-1].on_container_click) is 'function':
|
||||||
self.panels[-1].on_container_click(evt)
|
self.panels[-1].on_container_click(evt)
|
||||||
|
@ -392,6 +392,13 @@ class View:
|
|||||||
self.goto_named_destination(toc_node.dest, toc_node.frag)
|
self.goto_named_destination(toc_node.dest, toc_node.frag)
|
||||||
|
|
||||||
def on_update_cfi(self, data):
|
def on_update_cfi(self, data):
|
||||||
|
if self.overlay.is_visible:
|
||||||
|
# Chrome on Android stupidly resizes the viewport when the on
|
||||||
|
# screen keyboard is displayed. This means that the push_state()
|
||||||
|
# below causes the overlay to be closed, making it impossible to
|
||||||
|
# type anything into text boxes.
|
||||||
|
# See https://bugs.chromium.org/p/chromium/issues/detail?id=404315
|
||||||
|
return
|
||||||
self.currently_showing.bookpos = data.cfi
|
self.currently_showing.bookpos = data.cfi
|
||||||
push_state(self.ui.url_data, replace=data.replace_history, mode=read_book_mode)
|
push_state(self.ui.url_data, replace=data.replace_history, mode=read_book_mode)
|
||||||
username = get_interface_data().username
|
username = get_interface_data().username
|
||||||
|
Loading…
x
Reference in New Issue
Block a user