Fix tab activation regression in search highlighting#14089
Open
cderv wants to merge 1 commit intofeature/robust-search-highlightingfrom
Open
Fix tab activation regression in search highlighting#14089cderv wants to merge 1 commit intofeature/robust-search-highlightingfrom
cderv wants to merge 1 commit intofeature/robust-search-highlightingfrom
Conversation
…w timing Adapt openAllTabsetsContainingEl to: - Skip tab activation when the active pane already contains a match - Defer tab activation to pageshow so it runs after tabsets.js restores localStorage state (search activation wins over stored preference) - Scroll to first visible match after tab activation settles - Fix implicit global variable (const leaf)
Collaborator
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Important
This PR targets the
feature/robust-search-highlightingbranch (#14080), notmain. It is intended to be merged into #14080 before that PR merges intomain.Context
PR #14080 replaced
activateTabsWithMatches()(from #14053) withopenAllTabsetsContainingEl(), which is a much cleaner approach — 9 lines vs 65 — but dropped two behaviors that the playwright tests inhtml-search-tabsets.spec.tsverify.What regressed
"Keep active tab" logic — when multiple panes in the same tabset contain a match, the old code kept the already-active tab. The new code unconditionally activated each pane, so the last match processed won.
Pageshow timing — tab activation ran during
DOMContentLoaded, buttabsets.jsrestores tab state from localStorage onpageshow(which fires after). So localStorage overwrote search activation.Fix
Adapt
openAllTabsetsContainingEl(not replace it) with minimal changes:<mark>— skip if sohighlight()to apageshowhandler, so it runs aftertabsets.jsscrollToFirstVisibleMatchthat skips marks inside inactive tab panesfor (leaf of leafNodes)→for (const leaf of leafNodes)(implicit global)The adapted function stays at 9 lines (vs the 65-line
activateTabsWithMatchesit replaced).highlight()is simplified to marking-only.Test
All 6 tests × 3 browsers pass locally: