diff --git a/src/pyj/read_book/overlay.pyj b/src/pyj/read_book/overlay.pyj index 30934cf4f8..8cfd98ac6e 100644 --- a/src/pyj/read_book/overlay.pyj +++ b/src/pyj/read_book/overlay.pyj @@ -349,6 +349,10 @@ class Overlay: def container(self): return document.getElementById('book-overlay') + @property + def is_visible(self): + return self.container.style.display is not 'none' + def container_clicked(self, evt): if self.panels.length and jstype(self.panels[-1].on_container_click) is 'function': self.panels[-1].on_container_click(evt) diff --git a/src/pyj/read_book/view.pyj b/src/pyj/read_book/view.pyj index 82300749ae..e5fc039352 100644 --- a/src/pyj/read_book/view.pyj +++ b/src/pyj/read_book/view.pyj @@ -392,6 +392,13 @@ class View: self.goto_named_destination(toc_node.dest, toc_node.frag) 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 push_state(self.ui.url_data, replace=data.replace_history, mode=read_book_mode) username = get_interface_data().username