diff --git a/ext/js/dom/text-source-range.js b/ext/js/dom/text-source-range.js index 86b0041a4d..4450d32845 100644 --- a/ext/js/dom/text-source-range.js +++ b/ext/js/dom/text-source-range.js @@ -95,18 +95,6 @@ export class TextSourceRange { return this._imposterSourceElement; } - /** - * Determines whether the imposter source element is an input or textarea element. - * @returns {boolean} `true` if the imposter source element is an input or textarea element, `false` otherwise. - */ - isImposterInputOrTextArea() { - if (this._imposterSourceElement) { - const type = this._imposterSourceElement.nodeName.toUpperCase(); - return type === 'INPUT' || type === 'TEXTAREA'; - } - return false; - } - /** * Creates a clone of the instance. * @returns {TextSourceRange} The new clone. diff --git a/ext/js/language/text-scanner.js b/ext/js/language/text-scanner.js index c2f610f24f..797ce49228 100644 --- a/ext/js/language/text-scanner.js +++ b/ext/js/language/text-scanner.js @@ -23,7 +23,6 @@ import {log} from '../core/log.js'; import {clone} from '../core/utilities.js'; import {anyNodeMatchesSelector, everyNodeMatchesSelector, getActiveModifiers, getActiveModifiersAndButtons, isPointInSelection} from '../dom/document-util.js'; import {TextSourceElement} from '../dom/text-source-element.js'; -import {TextSourceRange} from '../dom/text-source-range.js'; /** * @augments EventDispatcher @@ -466,9 +465,14 @@ export class TextScanner extends EventDispatcher { async _search(textSource, searchTerms, searchKanji, inputInfo, showEmpty = false) { try { const isAltText = textSource instanceof TextSourceElement; - const isInputOrTextArea = textSource instanceof TextSourceRange && textSource.isImposterInputOrTextArea(); - if (inputInfo.pointerType === 'touch' && (isAltText || isInputOrTextArea)) { - return; + if (inputInfo.pointerType === 'touch') { + if (isAltText) { + return; + } + const {imposterSourceElement} = textSource; + if (imposterSourceElement instanceof HTMLTextAreaElement || imposterSourceElement instanceof HTMLInputElement) { + return; + } } const inputInfoDetail = inputInfo.detail;