[Repo Assist] Use Popover API for code snippet tooltips; fix scroll-offset positioning#1061
Draft
github-actions[bot] wants to merge 2 commits intomainfrom
Draft
Conversation
- Add `popover` attribute to `div.fsdocs-tip` elements in HtmlFormatting.fs,
placing them in the browser top layer when supported (Baseline 2024).
- Update fsdocs-tips.js to call showPopover()/hidePopover() on browsers that
support the Popover API; fall back to display:block/none on older browsers.
- Switch to `position: fixed` in the Popover API path (correct for top-layer
elements) and fix a scroll-offset bug where tooltips appeared at wrong
positions when the page was scrolled.
- Fix a minor bug in the right-edge overflow correction (was using `y` instead
of `x` as the base for the left-shift calculation).
- Add `div.fsdocs-tip:popover-open { display: block }` to fsdocs-default.css
so author-level display:none does not suppress the Popover API reveal.
- Update RELEASE_NOTES.md.
Closes #422
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This was referenced Mar 3, 2026
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.
🤖 This PR was created by Repo Assist, an automated AI assistant.
Closes #422
Summary
Migrates hover tooltips (the
div.fsdocs-tipelements shown when hovering over syntax tokens in code blocks) to use the browser-native [Popover API]((developer.mozilla.org/redacted), with a clean fallback for older browsers.Changes
src/FSharp.Formatting.CodeFormat/HtmlFormatting.fsAdd the
popoverattribute to every generateddiv.fsdocs-tipelement:docs/content/fsdocs-tips.jsposition: fixed, then callel.showPopover()/el.hidePopover(). Elements in the top layer are always rendered above all other page content — noz-indexarithmetic needed.position: absolute+display: block/nonebehaviour unchanged.yinstead ofxas the base for the left-shift; corrected tox.currentTipElementwas never cleared on hide; now set tonulltogether withcurrentTip.docs/content/fsdocs-default.cssAdd
div.fsdocs-tip:popover-open { display: block; }so the author-leveldisplay: nonerule does not suppress the Popover API reveal (author rules take precedence over UA rules in the cascade). Also addmargin: 0to prevent UA default popover margins from shifting the tooltip.Why the Popover API?
z-index: 1000clientX/Yused withposition: absolute→ offset when scrolledclientX/Yused withposition: fixedin top layerdocument.onkeydownhandlerautopopoversTest Status
dotnet build src/FSharp.Formatting.CodeFormat/— 0 warnings, 0 errorsdotnet test tests/FSharp.CodeFormat.Tests/— 20 passed, 2 skipped (pre-existing infrastructure skips).fsfile — no changes needed