Skip to content

feat(core): a Link without href renders its text like a Link with one - #8014

Closed
vjeux wants to merge 5 commits into
meta:mainfrom
vjeux:link-button-text
Closed

vjeux wants to merge 5 commits into
meta:mainfrom
vjeux:link-button-text

Conversation

@vjeux

@vjeux vjeux commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

User impact

Why: anyone with an action Link (no href) in uppercase, tracked or shadowed text: its words render plain, 78px wide beside a 134px link.

What led to it: moving one product onto Astryx meant dropping its reset patches; a reset-wide fix (#7531) was declined, leaving this gap.

Visual authority

  • Existing component/module DD row reused or amended.
  • Durable component-local intent added to the optional Design decisions table by a team design owner.
  • Correction already settled by current family, design, theme, or objective accessibility authority.
  • New shared or cross-component direction settled in docs/design/.

Options and tradeoffs: inherit in Link's button form (this PR; only styled action links change); inherit in the reset for every control (declined: controls keep their own style); a type-scale tracking token (misses case and shadow); or per-product restyling (repeated everywhere).

Why this choice: the smallest change making Link's two forms match. Text indent stays reset: inherited, it would indent the words inside the button's own box. Escape (restores main's look exactly): button.astryx-link { letter-spacing: normal; word-spacing: normal; text-transform: none; text-shadow: none; text-align: center; }.

Owner decision: whether component:Link FR6 takes these five for the button form (proposed DEC-1, pending owner review). Until then, patch [feat] (spec:AST-017 FR3, DEC-17).

Before and after

main this branch
Chromium 149 Before After
WebKit 26.5 Before After

State matrix

  • Every button form, wrapped or not, matches the link form; unstyled text, light, dark and RTL are unchanged.
  • Of 161 compared stories, only the new one changes.

Scope

  • Appearance is the primary intent.
  • Behavior, API, interaction model, and unrelated layout changes were removed or split.
  • The evidence shows the changed pixels actively running, not only source or computed styles.
  • Public text and artifacts contain no internal Meta context.

Writing rubric results

R1 narration: none.
R2 research: none.
R3 evidence: the row names the spec.
R4 rejected alternatives: one, in DEC-1.
R5 change references: none.
R6 open questions: none.

Testing

How to check: in the Core/Link story "Button Fallback In Styled Text", both links read uppercase, tracked and shadowed, at one width. Narrowed, both wrap to the left edge.

Evidence: LinkButtonText.a11y.browser.spec.ts checks that; it fails on main and passes here (Chromium in CI, WebKit 26.5 locally). With #7525, #7527 or #7529's reset added, they still match in all three browsers. pr-rtl is red only because main added an RTL test file after this branch last took main.

@vercel

vercel Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
astryx Ready Ready Preview Oct 27, 2026 9:07pm UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Oct 23, 2026
@github-actions github-actions Bot added the needs:design-review Affects visuals — Design should review label Oct 23, 2026
@astracat-bot

astracat-bot Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
❓ Needs maintainer input (for maintainers only) Nov 4, 2026, 2:16 PM UTC

@github-actions

github-actions Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

📚 Storybook Preview

View Storybook for this PR

🧪 Sandbox Preview

View Sandbox for this PR

Component Size

Component Import before Import after Delta CSS before CSS after Delta
core/Link 43.4KB 43.4KB +43B 7.6KB 7.6KB +53B
core/LinkProvider 3.5KB 3.5KB 0B 20B 20B 0B
core/SideNavHeading 54.6KB 54.6KB +60B 10.1KB 10.2KB +56B
core/TopNavHeading 54.0KB 54.1KB +60B 9.9KB 10.0KB +65B

Sizes are gzip. Import counts the JavaScript the import loads eagerly; CSS counts the package stylesheet rules referenced by the modules it can load from its own package, lazily loaded ones included.

Bundle Size Summary

Gzip figures measure each package's entry file, not the code an import pulls in.

Package Entry (ESM) Entry gzip before Entry gzip after Delta
@astryxdesign/core 4.9KB 1.2KB 1.2KB 0B
Package stylesheet Gzip before Gzip after Delta
@astryxdesign/core 34.3KB 34.3KB +42B

Accessibility Audit

Status: No accessibility violations detected.

Visual Regression

55 of 502 shot(s) changed.

A change here is a question, not a failure: check whether the after is the
picture you intended. Record that review on the PR. Baseline maintenance is an
explicit dispatch of CI; this report never rewrites the baseline or adds a release gate.

component story theme mode pixels
Selector Indicator Space Bottom Sheet Narrow End RTL neutral light 753,933
Selector Indicator Space Bottom Sheet Wide Start neutral light 740,072
RichTextEditor Markdown parity: side by side probe dark 558,840
RichTextEditor Markdown parity: side by side probe light 540,756
Chat Full AI Chat probe light 230,823
Chat Full AI Chat probe dark 229,805
AppShell With Mobile Nav probe light 217,010
AppShell With Mobile Nav probe dark 216,960
Collapsible Dividers probe dark 66,445
Collapsible Dividers probe light 66,445
AppShell Playground neutral dark 65,198
AppShell Playground neutral light 63,788
Chat Default neutral dark 36,304
Chat Default neutral light 35,767
Chat Empty State probe light 23,531
Chat Empty State probe dark 22,622
ChatAutoScroll Scroll Behavior Comparison neutral dark 15,378
ChatAutoScroll Scroll Behavior Comparison neutral light 14,107
Chat With Attachments probe light 13,406
Chat With Attachments probe dark 11,232

and 35 more.


Generated by PR Enrichment workflow | Storybook | Sandbox | View full report

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change does what it describes: in uppercase, tracked or shadowed text, a Link without href now renders the same words as the anchor form, links in plain text are unchanged, and the changeset's escape rule brings back the old look. Approval waits on governing spec for one decision that no current record covers: whether a Link's button form takes letter-spacing, word-spacing, text-transform and text-shadow from its surrounding text, as the anchor form does. An engineering owner records that decision by commenting /approve-spec followed by the full head SHA on this pull request, and as an engineering owner the author may do so. No code changes are requested.

[Automated review]

A Link without href renders a <button>, and browsers set letter-spacing,
word-spacing, text-transform and text-shadow on every <button>, so in
uppercase, tracked or shadowed text its words stayed lowercase, untracked
and plain beside an anchor form that matched the text. In Chromium 149,
WebKit 26.5 and Firefox 151 the anchor form's words computed 3.2px / 4.8px /
uppercase / shadow (134px wide) and the button form's normal / 0px / none /
none (78px).

The button form's own reset now inherits those four properties, as the
anchor form already does; text-indent and text-align stay reset, because
inherited they would indent or realign the button itself. A new story shows
both forms in styled text, and a real-browser spec over it checks that the
button form's words compute the same values and width as the anchor form's.
pr-a11y selects the spec by name (meta#8367); its @Pr-a11y scope line runs it
whenever Link's folder or its story changes.

The change alters only appearance, so the changeset is a patch [feat]
(spec:AST-017 FR3, DEC-17) that names the old and new look and the escape.
component:Link calls the button form "styled as a link", but its FR6 lists
only family, size, weight and line height as inherited; whether FR6 extends
to these four is the open owner decision.
… text's spacing, case and shadow

FR6 lists what Link's root inherits. With this pull request the button form
also inherits letter-spacing, word-spacing, text-transform and text-shadow,
so FR6 gains that clause, marked as proposed DEC-1 pending the record
owner's review.
@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Oct 26, 2026

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change does what it describes: in uppercase, tracked or shadowed text, a Link without href now renders its words like the anchor form, links in plain text are unchanged, and the changeset's escape rule brings back the old look exactly. Approval waits on one spec decision, whether component:Link FR6 takes the proposed button-form clause and DEC-1, which an engineering owner records by commenting /approve-spec followed by the full head SHA on this pull request; as an engineering owner, the author may do so. Before that, please correct the reason DEC-1, the comment in Link.tsx and the changeset give for keeping text-align reset: inheriting it does not move the button, it only starts wrapped lines at the edge as the anchor form does, so under this proposal wrapped button-form text stays centered.

[Automated review]

Comment thread packages/core/src/Link/Link.spec.md Resolved
Comment thread packages/core/src/Link/Link.tsx Resolved
The button form now also inherits text-align, so its wrapped lines start
where the anchor form's do instead of centering. Inheriting it never moved
the button itself, as the earlier comment, changeset and DEC-1 said. Text
indent stays reset: inherited, it would indent the words inside the button's
own box. The browser spec gains a wrapped-lines case, and the changeset's
escape gains text-align: center.

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change does what it describes: in uppercase, tracked, shadowed or wrapped text, a Link without href now renders its words like the anchor form, while links in plain text and the existing Link stories are unchanged. Approval waits on one spec decision, whether component:Link FR6 takes the proposed button-form clause (letter spacing, word spacing, text transform, text shadow and text alignment inherited from the surrounding text) together with DEC-1, which keeps text indent reset; an engineering owner records it by commenting /approve-spec followed by the full head SHA on this pull request, and as an engineering owner the author may do so. Optionally, before that approval, list the new browser check in the record's verified_by and verification map, since any later commit needs a fresh approval.

[Automated review]

…sed evidence

The verification map gains a proposed FR6 row for
LinkButtonText.a11y.browser.spec.ts (both cases, Chromium and WebKit), and
the record's verified_by lists the spec, so an owner approving DEC-1 needs
no later commit.

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change does what it describes: in uppercase, tracked, shadowed or wrapped text, a Link without href now renders its words like the anchor form, while links in plain text and the existing Link stories are unchanged. Approval waits on one spec decision: whether component:Link FR6 takes the proposed button-form clause (letter spacing, word spacing, text transform, text shadow and text alignment inherited from the surrounding text), its verification row and DEC-1, which keeps text indent reset. An engineering owner records that decision by commenting /approve-spec followed by the full head SHA on this pull request, and as an engineering owner the author may do so. No code changes are requested.

[Automated review]

CI runs LinkButtonText.a11y.browser.spec.ts in Chromium only, so the
proposed FR6 verification row names Chromium alone; WebKit runs stay local
evidence in the pull request.

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change does what it describes: in uppercase, tracked, shadowed or wrapped text, a Link without href now renders its words like the anchor form, links in plain text and the existing Link stories are unchanged, and the changeset's escape rule restores the old look exactly. Approval waits on one spec decision: whether component:Link FR6 takes the proposed button-form clause (letter spacing, word spacing, text transform, text shadow and text alignment inherited from the surrounding text), its verification row and DEC-1, which keeps text indent reset. An engineering owner records that decision by commenting /approve-spec followed by the full head SHA on this pull request, and as an engineering owner the author may do so. No code changes are requested.

[Automated review]

@vjeux
vjeux marked this pull request as draft October 29, 2026 22:45
@vjeux
vjeux marked this pull request as ready for review October 30, 2026 00:00
@vjeux
vjeux marked this pull request as draft October 30, 2026 03:37
cixzhang pushed a commit that referenced this pull request Oct 30, 2026
…#8381)

## User impact

**Why:** Keyboard and screen reader users lose their place when a dialog inside an iframe closes: both ways to close it (2 of 2: Escape or a button) send focus to the frame's empty page.

**What:** The dialog now returns focus to the control that opened it, with a ring after a key, none after a click. Picture-in-Picture windows were already fine.

**How to check:** In the "Dialog in a second document" story, open the frame's dialog and press Escape: focus returns to "Open dialog", with its ring.

## Problem and solution fit

What led here: we hit this moving one product onto Astryx, which renders some UI in a second window. Dialog remembers its opener as the page's `document.activeElement`, which for focus inside an iframe is the `<iframe>`. Focusing that `<iframe>` on close moves the frame's focus to its `<body>`.

Options:

- Follow the page's active element into iframes: misses Picture-in-Picture windows, which the page cannot see into.
- Always read the dialog's own document: a page control opening a dialog inside an iframe would lose focus.
- Read the dialog's own document while it has focus, else the page's: covers both. Chosen.

For the ring, Dialog tracks its own document's input, which the page never hears. Skipping its focus call would change the page, where it hides WebKit's ring after a click.

## Expected behavior and authority

`component:Dialog` (current) FR4 and AR2: closing returns focus to the element that opened it. `architecture:interaction-modality` (current) INV1: programmatic focus shows the ring only after keyboard input. Neither is page-only; #7356 fixed this for Popover.

## Smallest restoration

- `Dialog.tsx`: record the opener as above, take the entry direction from its window, return focus with its document's modality.
- Internal utils: `trackInteractionModalityIn(doc)`, counted so the last mounted Dialog removes its listeners; an optional document for `getInteractionModality`; an optional modality for `focusForLastInput`, which checks text fields against their own window. The page's tracker and other callers are unchanged.

No public API, visual or timing change.

## Evidence

- Reproduction before the change: main fails the iframe cases in Chromium and WebKit.
- Result after the change: every case passes.
- Representative unchanged path: the page Dialog passes before and after; the page's modality ignores other documents.
- Regression test or other mutation-sensitive proof: the Testing cases, red without the fix.

## Scope

- [x] One defect is restored.
- [x] Separable contradictory or unsettled tagalongs were removed or split.
- [x] No new public API, visual representation, default, or interaction model is hidden under the bug-fix label.
- [x] Public text and artifacts contain no internal Meta context.

## Testing

- Unit tests (Vitest), 115 files and 3137 tests: Dialog and every other component that returns focus or reads the last input. New cases cover a control inside an iframe, a control in the page, a text field, and the input listeners going away when the last Dialog unmounts. Each new case fails on the code from before the fix it covers.
- Browser test in Chromium, 10 cases (`DialogSecondDocument.a11y.browser.spec.ts`): the dialog in the page, an iframe and a Picture-in-Picture window, closed with Escape, with a click, and after a text field opened it, plus a page button that opens a dialog in the iframe. All pass. With the code from before the last review round (0d47027), the iframe and Picture-in-Picture text-field cases fail; with main's `Dialog.tsx`, the iframe cases fail.
- The same test in WebKit 26.5: 7 pass, and the 3 Picture-in-Picture cases are skipped, since only Chromium has that window.
- CI finds the test by its file name (#8367), and its routing line also covers its story and the two utilities. Locally, `pnpm test:a11y-contract:pr origin/main` picks it and passes 115 browser tests.
- Typecheck, repo checks, ESLint and Prettier pass. Merged with our open #7732, #8014 and #7524, typecheck and the utility tests (516) pass; #7525, #7527 and #7529 each merge cleanly with this change.
cixzhang pushed a commit that referenced this pull request Oct 31, 2026
…8543)

CI note: this head's checks were blocked by the repository's Actions policy (no jobs ran since 17:43Z); they need a re-run.

## Why, what, how to check

**Why.** This comes from one product's effort to get its production JavaScript errors to zero: its log shows this one 12 times from 5 people in 7 days (9 on WebKit, 3 on Chrome). Pressing Escape inside an open popover throws it: the browser closes the popover and returns focus to its button, the tooltip there asks to open while the close still runs, and Chromium 151 and 156 refuse (149 does not). The tooltip stays closed.

**What led here.** The Popover API refuses a show while any popover shows or hides, and a hide returns focus inside that window. #6941 makes a show wait while `useLayer` runs its own show or hide; a close the browser runs itself (Escape, a tap outside) never entered that bookkeeping.

**Options.** (a) Catch the error and drop it: hides a real failure, and the tooltip still never opens. (b) Wait out every browser close before any show: tried first; it delayed a press that closes one menu and opens another, so focus no longer moved into the new menu. (c) Count the browser's close, try the show at once, retry after the close only if the browser refused. Chosen: it fixes the Escape case and keeps every other path as fast as before.

**What.** `useLayer` counts the browser's own popover closes in its ledger, from the close's start to its `toggle` event; a show refused during one replays after it, once.

**How to check.** Storybook `Core/Layer` → `BrowserHideWakesAFocusLayer`, Chromium 151+: Tab, Enter, Tab, Escape. Before: `InvalidStateError` in the console, no tooltip. After: no error, the tooltip shows.

## Expected behavior and authority

`architecture:layer-runtime` (current): browser-initiated closes are observed through the queued `toggle` event; that holds. Restored: #6941.

## Smallest restoration

- `popoverOperations.ts` holds the ledger `useLayer.tsx` kept privately, plus the browser-close count and the replay, tested alone there. No public API, default, record or visual change.

## Scope

- [x] One defect is restored.
- [x] Separable contradictory or unsettled tagalongs were removed or split.
- [x] No new public API, visual representation, default, or interaction model is hidden under the bug-fix label.
- [x] Public text and artifacts contain no internal Meta context.

## Testing

- Unit tests for Layer, its ledger, Tooltip, DropdownMenu, Popover, Drawer and Selector: 7 files, 652 passed. Without the fix, `useLayer.test.tsx` "defers the show a browser-run hide wakes…" and "keeps counting…" fail; with option (b), "opens a layer at once…" fails; `popoverOperations.test.ts` "ends each hide exactly once…" fails without `clearTimeout`.
- Type check, repository checks, lint, formatting: clean.
- Browser spec `LayerBrowserHide.a11y.chromium.spec.ts` (3 cases) on this branch's Storybook build: 3 passed. CI's Playwright runs Chromium 149, which allows these shows, so there the spec passes on main too. On Chromium 156 the story's steps throw `InvalidStateError … during another show operation` on main, tooltip hidden, and show it with no error here; a tap outside closes the layer with no error on both; the press that closes one layer and opens another focuses the new one at once.
- Open PRs #7732, #8381 and #8014 touch nothing under `packages/core/src/Layer/`; a trial merge with #7732 is clean; the other two conflict with main on their own.
@vjeux vjeux closed this Nov 4, 2026
@cixzhang cixzhang reopened this Nov 4, 2026
@vjeux vjeux closed this Nov 4, 2026

This branch was successfully deployed

1 active deployment
Preview — bb749e66 Deployed Oct 27, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot. needs:design-review Affects visuals — Design should review needs:spec-owner-review Current knowledge records await owner approval

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants