From e2d050c76108469135319f24d193a275b9c4bfdf Mon Sep 17 00:00:00 2001 From: Khai Truong Date: Thu, 26 Sep 2024 00:28:31 +0700 Subject: [PATCH] allow scan input text when tapping on same position --- ext/js/language/text-scanner.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ext/js/language/text-scanner.js b/ext/js/language/text-scanner.js index 797ce49228..58c6b1f294 100644 --- a/ext/js/language/text-scanner.js +++ b/ext/js/language/text-scanner.js @@ -469,9 +469,12 @@ export class TextScanner extends EventDispatcher { if (isAltText) { return; } - const {imposterSourceElement} = textSource; + const {imposterSourceElement, rangeStartOffset} = textSource; if (imposterSourceElement instanceof HTMLTextAreaElement || imposterSourceElement instanceof HTMLInputElement) { - return; + const isFocused = imposterSourceElement === document.activeElement; + if (!isFocused || imposterSourceElement.selectionStart !== rangeStartOffset) { + return; + } } }