Repository navigation
Stand a pin on the drawn part it comments on, not the drawing's edge - #1236
Merged
Merged
Conversation
A shape inside an inline SVG has no CSS box, so its margin row anchors through the <svg>. The row already took the shape's top from an inset; as a pin it still took the drawing's right edge, so a comment on the first of four thumbnails stood beside the fourth. The layout pass now reads the target's corner inside its anchor as a top and a right inset, and the pin stands `--pin-inset` inside the target's own right edge. The same holds for a target reached through a shadow host or a `display: contents` target's first part. The new browser test comments on the left and right shapes of a wide drawing and requires each pin inside its own shape; on the old runtime the left shape's pin stands at the drawing's right edge. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The layout pass read an inset from the anchor's box, then added it back wherever it needed the target's top or right edge. It now reads the target's corner once (`cornerOf`); visibility and packing use it directly, and the insets the stylesheet takes are written from it. No behavior moves. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
leaf-agent
reviewed
Sep 26, 2026
leaf-agent
left a comment
Collaborator
There was a problem hiding this comment.
A visible multi-part target can lose its pin because the visibility check still uses only the box that supplies its CSS anchor.
A display: contents target anchors through its first part, but its pin now stands at the corner of all its parts; the pin check still measured against the first part's box, so two side-by-side parts withheld a pin both of whose parts were in view. The pass now reads the box the target's shown parts cover together (shownExtent) and clips that by the target's own scrollers, for the top line and the pin's right edge alike. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
leaf-agent
approved these changes
Sep 26, 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.
A comment on one shape of an inline SVG drawing put its pin at the drawing's right edge, beside a different shape. In the case that prompted this, a comment on the first of four thumbnails in a wide figure pinned beside the fourth, and its card opened over that one.
A shape inside an
<svg>has no CSS box, and Chrome won't anchor to one:anchor-nameon a<g>or<rect>falls back in Chrome 154. So its margin row anchors through the drawing. The layout pass already moved the row down to the shape's top with an inset. The pin posture from #1164 never did the same horizontally, so the pin stood--pin-insetinside the drawing's right edge.The layout pass now reads the box the target's shown parts cover together (
shownExtentinmargin-layout.js), and the row stands at that box's top-right corner whatever it anchors through. The pass writes the corner as two insets from the anchor's box:--lf-inset-top(renamed from--lf-inset) and--lf-inset-right, whichtheme.cssadds to the pin'sright. The visibility check clips the same box by the target's own scrollers, for the top line and the pin's right edge alike, and packing uses its right edge. The same holds for a target anchored through a shadow host and for adisplay: contentstarget, which anchors through its first part but stands at the corner of all of them. Whether a row stands in the rail or as a pin is still decided by how far the whole figure reaches.Two browser tests pin the behavior.
test_a_pin_on_one_shape_of_a_drawing_stands_on_that_shapecomments on two shapes of a wide drawing and requires each pin inside its own shape; onmainthe left shape's pin stands at x≈1347 against a shape ending at x≈402.test_a_pin_on_a_contents_target_stands_at_its_last_partcovers adisplay: contentstarget with side-by-side parts, which an intermediate version of this branch withheld. The glossary,packages.mdandpage-authoring.mdnow say a pin stands inside its target's corner, and on a figure at the corner of the part a comment names.🤖 Generated with Claude Code