Repository navigation
Keep a link's external mark on the line of its last word - #6626
Merged
Merged
Conversation
The mark Leaf draws after a link that leaves the page was an inline-block, and CSS Text 3 puts a soft wrap opportunity on each side of an atomic inline, so in a narrow thread card "(4d92cd2 ↗)." broke as "(4d92cd2" / "↗).". Wikipedia (a background on the link, with end padding), MDN (an absolutely positioned ::after in the link's end padding) and USWDS (an inline ::after with padding) all keep the icon with the word. The mark is now an inline box holding a word joiner, which allows no break before it, with empty alternative text so the link's accessible name is unchanged. Its font size and line height are 0, so its content area sits on the baseline and it adds no height to the line; its padding holds the icon, sized in the link's em through a registered --lf-external-em. At 33 sizes in three fonts it draws pixel-identical to the old mark in Firefox, and differs only in antialiasing in Chromium and WebKit. The mask fills the box at 100% 100% because WebKit paints an inline box's background in the sliver a `contain`-sized mask leaves uncovered. The draft field's copy of the rule takes the same form, and the `.lf-external-mark` selector leaves surfaces.css, which never reached the field's closed shadow root. The shadow-stage test now checks that the mark is drawn an em wide and stays on its word's line at every width from 120 to 300px, in place of reading its display. It fails on the inline-block rule and without the registered property.
leaf-agent
approved these changes
Nov 20, 2026
max-sixty
added a commit
that referenced
this pull request
Nov 21, 2026
…d shares (#6631) #6626 kept the external-link mark on its word's line with a word joiner in a zero-size inline box, sized through a registered `@property`, plus a copy of the rule in the draft field's closed shadow root. This replaces both with one shorter rule. An empty inline `::after` adds no line break opportunity, so its padding, which holds the icon, stays with the link's last character, as USWDS's external-link mark does. The field's mark widget exposes `part="lf-external-mark"`, so the same rule draws it through `::part()`, which reaches a closed root in Chromium, Firefox and WebKit. The field's copy of the rule goes. The trade to weigh: the icon is now centred in a box as tall as the link's font rather than anchored to the baseline, so it sits 0–2px lower depending on the font. A thread card's 14px system-ui draws identically in Firefox. Left is #6626, right is this change, in Firefox at 2x: <img width="656" alt="The same caption in five fonts, #6626 left and this change right; the icon sits up to 2px lower on the right" src="https://gist.githubusercontent.com/max-sixty/89b94640ff70884d3ee03a834c905ac1/raw/202b4facb021365f384494da0c533174c4e60828/mark-landed-vs-simple.png"> Two rules carry the remaining cost. A second, transparent mask layer stops WebKit 27.2 from painting the whole box under a single smaller no-repeat mask; this is recorded with a repro in `notes/browser-support.md`. `height: 0.75em`, which an inline box ignores, keeps the mark drawn on a link laid out as a flex container, such as the trace gallery's Playwright link. Max asked whether the follow-ups could be simpler. Codex reviewed it twice: its first review moved the field back to a point widget, and its second restored the field mark's accent colour. Tests run: the presentation, go-to, draft-placement and reply-markdown browser tests; `test:runtime`; `pnpm run check`; and Firefox stills. The draft-placement test fails without the `::part` selector. The draft field draws every link shape I tried (plain, emphasised, empty, escaped, entity, two-line) pixel-identical to #6626. > _This was written by Claude Code on behalf of max-sixty_
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.
The mark Leaf draws after a link that leaves the page was an inline-block, and CSS Text 3 allows a line break on each side of an inline-block, so in a narrow thread card the icon could start a line alone, apart from its link. Wikipedia, MDN and USWDS all keep the icon with the link's last word. The mark is now an inline box holding a word joiner, which allows no break before it, with empty alternative text so the link's accessible name is unchanged. Its font size and line height are 0, so it sits on the baseline and adds no line height; its padding holds the icon, sized in the link's em through a registered
--lf-external-em.Before and after, the same card in Firefox at the width it broke:
At 33 sizes in three fonts the mark draws pixel-identical to the old one in Firefox, and differs only in antialiasing in Chromium and WebKit. The mask fills the box at
100% 100%because WebKit paints the sliver acontain-sized mask leaves. The draft field keeps its own copy of the rule, since its closed shadow root doesn't get the theme. A link whose text ends in a space or an inline-block (an image) can still lose its mark to the next line, as before.Max asked for this; a fresh visual pass and Codex reviewed it. The shadow-stage presentation test now fails on the inline-block rule and without the registered property.