Skip to content

Commit d2f0e46

Browse files
Fix an issue that could cause some browsers to scroll to the bottom unexpectedly
1 parent b6bcda6 commit d2f0e46

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

highlight-helper.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1241,11 +1241,11 @@ if (isTouchDevice && isWebKit) {
12411241
tempInput.inputMode = 'none'; // Don't show keyboard
12421242
tempInput.tabIndex = -1; // Prevent user from tabbing to input
12431243
const initializeSelection = (event) => {
1244-
if (document.readyState !== 'complete') return setTimeout(initializeSelection, 10);
1245-
document.body.append(tempInput);
1244+
if (document.readyState !== 'complete') return setTimeout(initializeSelection, 20);
1245+
if (!tempInput.parentElement) document.body.append(tempInput);
12461246
tempInput.focus();
12471247
setTimeout(() => {
1248-
tempInput.remove();
1248+
tempInput.blur();
12491249
}, 100);
12501250
}
12511251
initializeSelection();

0 commit comments

Comments
 (0)