Summary
Text.Block(...).Anchor("foo") (and any non-heading Text variant with an anchor) renders no id on the DOM element, so document.getElementById("foo") returns null and anchor/#fragment scrolling silently does nothing.
Root cause
In src/frontend/src/widgets/primitives/TextBlockWidget.tsx, the anchor prop is passed to the variant component as id={anchor} (line ~238), but only the H1–H6 variants actually destructure and apply id. All 14 other variants — Literal, Block, P, Inline, Blockquote, Monospaced, Lead, Muted, Danger, Warning, Success, Label, Strong, Display — have the signature ({ children, className, style }) => ... and never render the id.
So for non-heading variants the id is dropped on the floor.
Impact / repro
In Ivy-Tendril's Review → Changes tab (ChangesTabView.cs), each file diff is preceded by Text.Block("").Anchor(path) and the file tree calls client.Redirect($"#{path}") on select. Because the Block variant drops the id:
Redirect("#<path>") → frontend extractAnchorId → document.getElementById("<path>") → null
scrollIntoView is never called → clicking a file in the tree does not scroll to its diff.
(That code path predates the recent mobile-dropdown work; this is not a regression from PR #1294.)
Suggested fix
Make every variant honor the id it's already being given (the VariantMap type already declares id?: string). Either:
- thread
id into each variant's rendered element, or
- wrap the rendered component in an anchor element that carries the
id when anchor is set (headings already self-apply id, so avoid emitting a duplicate for those).
Affected file
src/frontend/src/widgets/primitives/TextBlockWidget.tsx
Summary
Text.Block(...).Anchor("foo")(and any non-headingTextvariant with an anchor) renders noidon the DOM element, sodocument.getElementById("foo")returnsnulland anchor/#fragmentscrolling silently does nothing.Root cause
In
src/frontend/src/widgets/primitives/TextBlockWidget.tsx, theanchorprop is passed to the variant component asid={anchor}(line ~238), but only theH1–H6variants actually destructure and applyid. All 14 other variants —Literal,Block,P,Inline,Blockquote,Monospaced,Lead,Muted,Danger,Warning,Success,Label,Strong,Display— have the signature({ children, className, style }) => ...and never render theid.So for non-heading variants the id is dropped on the floor.
Impact / repro
In Ivy-Tendril's Review → Changes tab (
ChangesTabView.cs), each file diff is preceded byText.Block("").Anchor(path)and the file tree callsclient.Redirect($"#{path}")on select. Because theBlockvariant drops the id:Redirect("#<path>")→ frontendextractAnchorId→document.getElementById("<path>")→ nullscrollIntoViewis never called → clicking a file in the tree does not scroll to its diff.(That code path predates the recent mobile-dropdown work; this is not a regression from PR #1294.)
Suggested fix
Make every variant honor the
idit's already being given (theVariantMaptype already declaresid?: string). Either:idinto each variant's rendered element, oridwhenanchoris set (headings already self-applyid, so avoid emitting a duplicate for those).Affected file
src/frontend/src/widgets/primitives/TextBlockWidget.tsx