You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Search highlights (<mark>) cleared within milliseconds, invisible to users #14047
When navigating to a page via search (with ?q= parameter), the highlight() function adds <mark> elements around matching text. These marks are then cleared almost immediately (~24ms on quarto.org) by quarto-hrChanged events, making them invisible to users.
Steps to Reproduce
Go to any Quarto website page with ?q=someterm (e.g. html-basics.html?q=format)
Observe that no highlighted text is visible
Instrumented testing on quarto.org shows marks appear and disappear within a single frame:
404ms: 17 <mark> elements added by highlight()
428ms: 0 <mark> elements — all cleared by resetHighlighting()
The comment says "Clear search highlighting when the user scrolls sufficiently", but the event fires from layout recalculation, not user interaction.
Context
PR #14003 added text fragments (:~:text=) to search result URLs, which provides browser-native scroll-to-text highlighting that persists independently. This effectively works around the broken <mark> behavior for visible text, but text fragments cannot highlight content inside hidden elements (e.g. inactive Bootstrap tab panes).
Possible Fix
Delay the quarto-hrChanged/quarto-sectionChanged listener registration to skip initial layout settling events, or gate the clearing on actual user interaction (scroll, click).
While investigating this fix, I tested the interaction between JS <mark> highlights (?q=) and browser text fragments (:~:text=, added in #14003), building on observations from #13123.
:~:text= scrolls to and highlights one specific match (browser-native)
On fuse.js sites, they conflict: highlight() wraps text in <mark> tags, and this DOM mutation destroys the browser's text fragment highlight. Even with replaceState() blocked, the DOM mutation alone kills the text fragment. replaceState() then also strips :~:text= from the URL as collateral (since new URL(window.location) can't see text fragments).
On Algolia sites (e.g. quarto.org), there's no conflict because ?q= is only added by fuseSearch(), not the Algolia path — though this is a configuration gap rather than a fundamental difference (#13123).
The fix in #14049 addresses the <mark> clearing. The text fragment conflict is a separate pre-existing interaction.
Activity
mcanouil commentedon Feb 17, 2026
For reference:
cscheid commentedon Feb 17, 2026
Between now and release, can we mark all "default" issues to 1.10?
Fix search highlights cleared by layout settling events
Initial demo site for search highlight fix
cderv commentedon Feb 18, 2026
While investigating this fix, I tested the interaction between JS
<mark>highlights (?q=) and browser text fragments (:~:text=, added in #14003), building on observations from #13123.The two mechanisms serve different purposes:
<mark>highlights all matches on the page (useful on long pages, as noted in Auto-focus Algolia search box on page load when there's a query parameter #13123):~:text=scrolls to and highlights one specific match (browser-native)On fuse.js sites, they conflict:
highlight()wraps text in<mark>tags, and this DOM mutation destroys the browser's text fragment highlight. Even withreplaceState()blocked, the DOM mutation alone kills the text fragment.replaceState()then also strips:~:text=from the URL as collateral (sincenew URL(window.location)can't see text fragments).On Algolia sites (e.g. quarto.org), there's no conflict because
?q=is only added byfuseSearch(), not the Algolia path — though this is a configuration gap rather than a fundamental difference (#13123).The fix in #14049 addresses the
<mark>clearing. The text fragment conflict is a separate pre-existing interaction.vezwork commentedon Feb 19, 2026
See #9802
Add test coverage for search highlight persistence (#14047, #9802)
Simplify scroll persistence test to use actual scrolling
Add test coverage for search highlight persistence (#14047, #9802) (#…