From 378e21b90712bc675a83feee39f23b23b3761a3d Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 6 Nov 2023 16:50:20 +0530 Subject: [PATCH] E-book viewer: Read aloud: Fix clicking on empty spaces causing read aloud to restart from beginning of chapter. Fixes #2042791 [ebook-viewer read aloud click no text area return to first page](https://bugs.launchpad.net/calibre/+bug/2042791) --- src/pyj/read_book/iframe.pyj | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/pyj/read_book/iframe.pyj b/src/pyj/read_book/iframe.pyj index 526ba30dca..da0dee7e84 100644 --- a/src/pyj/read_book/iframe.pyj +++ b/src/pyj/read_book/iframe.pyj @@ -988,6 +988,8 @@ class IframeBoss: text_node, offset = None, 0 if data.pos: r = word_at_point(data.pos.x, data.pos.y) + if not r: + return else: r = first_visible_word() if r and r.startContainer?.nodeType is Node.TEXT_NODE: