LibWeb: Reset find-in-page index if selection is cleared

Previously, if the user made a find-in-page query, then cleared the
selection made by that query, subsequent queries would inadvertently
advance to the next match instead of reselecting the first match.
This commit is contained in:
Tim Ledbetter 2025-02-07 17:25:55 +00:00 committed by Tim Ledbetter
commit 9e556972ae
Notes: github-actions[bot] 2025-02-09 18:20:56 +00:00
3 changed files with 37 additions and 22 deletions

View file

@ -0,0 +1,12 @@
<!DOCTYPE html>
<script src="../include.js"></script>
<div>test</div>
<script>
test(() => {
let result = window.find("test");
println(`window.find("test") initial result: ${result}`);
window.getSelection().removeAllRanges();
result = window.find("test");
println(`window.find("test") after clearing the previous selection: ${result}`);
});
</script>