Skip to content

feat(core): the reset styles a file input's button like a bare button - #7529

Draft
vjeux wants to merge 5 commits into
meta:mainfrom
vjeux:reset-file-selector-button
Draft

vjeux wants to merge 5 commits into
meta:mainfrom
vjeux:reset-file-selector-button

Conversation

@vjeux

@vjeux vjeux commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

User impact

Why: anyone showing a native file input under the reset: its button keeps the browser's grey fill, 2px outset border and font beside plain-text <button>s.

What led to it: one product we're moving onto Astryx undoes this itself.

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: extend the reset's button rule to ::file-selector-button (this PR; bare file inputs change look). Or keep the browser's look, which clashes with bare buttons. Or style it only in FileInput, which hides its native input, so bare inputs still clash.

Why this choice: the reset already makes bare buttons plain text. This reaches the file button, a pseudo-element its selectors miss, enabled and disabled, keeping its padding and margin. Escape: ::file-selector-button { all: revert; } restores the browser's look.

Owner decision: whether the reset's button rule reaches the file input's button. No current record governs what the reset does to native control parts (spec:AST-080 covers only its layer), so patch [feat] (spec:AST-017 FR3, DEC-17).

Before and after

Top row enabled, bottom disabled, each beside a bare <button> ("Upload"), on a page with only the reset. main 3e58ae0 against this change at 494a49e. iOS 26.2 Safari (iPhone 17 Pro Simulator), where the bare button falls past the screen's edge:

main this branch
Before: grey Choose File pills, the disabled one paler After: plain-text Choose File, enabled and disabled alike

Chrome 149 (Chrome for Testing):

main this branch
Before: grey Choose File buttons After: plain-text Choose File buttons

State matrix

  • Disabled: loses the browser's greyed look, like a disabled bare <button>; the cursor stays the arrow, as on main.
  • Chromium 149: 13 computed values match a bare button. Before a rebase, WebKit 26.5 matched too. iOS 26.2 Safari at 494a49e: the grey pill becomes plain text, as above.
  • Light, dark, LTR, RTL: takes the input's color and direction. Escape: five computed values match main's, enabled and disabled.
  • Unchanged: every Astryx component.

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.

Testing

How to check: put a file input beside a bare <button> under the reset: grey and bordered on main, both plain text here.

Evidence: reset.file-selector-button.a11y.browser.spec.ts passes here and fails with main's reset.css (Chromium in CI; WebKit 26.5 locally, before a rebase). The reset's Chromium contract (6 tests), its unit, until-found and Pages tests (21), the pre-commit checks and core typecheck pass.

  • 182c278 merges main 3e58ae0 and regenerates the reset.css hash in the pages manifest, the one conflict. Then ca45e85 takes the browser check's test from @astryxdesign/a11y-spec/playwright, as main's lint now requires, and the check passes as before.
  • 494a49e names what the file button's reset gives it in the release note, and adds that it keeps the arrow cursor. It also splits the rule's comment as review suggested, with the Pages copy and its hash.
  • 7845c28 merges main e5df607 and regenerates the reset.css hash in the pages manifest, the one conflict. This change's own lines are unchanged. Main's only change to the reset is the placeholder's dark-mode color, which the light stills above do not show. At 7845c28, the file button's browser check in Chromium, its unit and Pages tests, changesets, coverage, core typecheck and check:repo pass.

@vercel

vercel Bot commented Oct 14, 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 Nov 19, 2026 6:49am UTC

Request Review

@astracat-bot

astracat-bot Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
❓ Needs maintainer input (for maintainers only) Nov 19, 2026, 7:01 AM UTC

@github-actions github-actions Bot added the needs:design-review Affects visuals — Design should review label Oct 14, 2026
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Oct 14, 2026
@vjeux
vjeux force-pushed the reset-file-selector-button branch from e41bc52 to fe0b59c Compare October 14, 2026 15:55
@vjeux

vjeux commented Oct 14, 2026

Copy link
Copy Markdown
Contributor Author

Real Safari check (iOS simulators, Safari 18.6 and Safari 26.2): with main's reset, the file input's button is the browser's blue "Choose File" pill; with this branch's, it is plain text in the page's Georgia bold, matching the bare button beside it. iOS Safari's getComputedStyle(input, "::file-selector-button") reports the input's own style, so on iOS the screenshots are the evidence.

@github-actions

github-actions Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

Current run: The current CI run concluded skipped. Current analysis is unavailable.


Generated by PR Enrichment workflow | View current CI run

@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 is on hold for a maintainer decision: no current spec says what reset.css does to native control parts, so approval needs a maintainer to provide or identify the governing spec for giving a bare file input's button the bare-button look, including that a disabled one then looks enabled and keeps the arrow cursor. Separately, the Changeset should be a patch ([feat], or [fix] if current visual authority is identified) rather than minor [breaking], because AST-017 FR3 treats an appearance-only change as nonbreaking when the surface's own record is silent (FR54), and that also clears the check:changesets failure. When you rewrite it, naming the disabled-state change and the escape ::file-selector-button { all: revert; }, which restored the browser look in Chromium and Firefox, would help consumers.

[Automated review]

@vjeux vjeux changed the title fix(core)!: a file input's button gets the reset every button gets feat(core): the reset styles a file input's button like a bare button Oct 20, 2026
@vjeux
vjeux force-pushed the reset-file-selector-button branch from fe0b59c to ca07a17 Compare October 20, 2026 14:14

@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 is on hold for a maintainer decision: no current spec says what reset.css does to native control parts, so approval needs a maintainer to provide or identify the governing spec for giving a bare file input's button the bare-button look. That decision should also settle the rule's two consequences: a disabled file input's button then paints like an enabled one, and the button keeps the arrow cursor where a bare <button> gets a pointer. Nothing else needs to change: the patch [feat] Changeset fits an appearance-only change, its escape restores the browser's look, and Astryx's FileInput renders identically.

[Automated review]

@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 is on hold for a maintainer decision: no current spec says what reset.css does to native control parts, so approval needs a maintainer to provide or identify the governing spec for giving a bare file input's button the bare-button look. That decision should also settle the rule's two consequences: a disabled file input's button then paints like an enabled one, and the button keeps the arrow cursor where a bare <button> gets a pointer. Nothing else in the change needs work: the patch [feat] Changeset fits an appearance-only change, its escape restores the browser's look exactly, and Astryx's FileInput renders identically; the failing pr-a11y step comes from a workflow change that landed on main after this branch's base, so a rebase should clear it.

[Automated review]

`::file-selector-button` is a pseudo-element, so the reset's element
selectors never reach it, and a bare file input kept the browser's font
stack, button text color, 2px outset border and grey fill beside buttons
the reset already turns into plain text. It now gets the reset's box model,
font and color inheritance and button reset, in its own rule so that a
browser that does not know the pseudo-element drops only that rule; its
own padding and margin stay. Astryx's FileInput hides its native input and
looks the same.

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, the disabled
state and the escape. No current record governs what reset.css declares.

The GitHub Pages landing serves a byte-identical copy of the file, which
its test requires to match, so the copy and its manifest hash move with it.

@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 is on hold for a maintainer decision: no current spec says what reset.css does to native control parts, so approval needs a maintainer to provide or identify the governing spec for giving a bare file input's button the bare-button look. That decision should also settle the rule's two consequences: a disabled file input's button then paints like an enabled one, and the button keeps the arrow cursor where a bare <button> gets a pointer. Nothing else in the change needs work: the patch [feat] Changeset fits an appearance-only change, its escape restores the browser's look exactly, and Astryx's FileInput renders identically.

[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 29, 2026 23:59
@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.
@vjeux vjeux closed this Nov 4, 2026
@cixzhang cixzhang reopened this Nov 4, 2026
@github-actions github-actions Bot removed the needs:design-review Affects visuals — Design should review label Nov 4, 2026
@github-actions github-actions Bot added the needs:design-review Affects visuals — Design should review label Nov 17, 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.

Approval waits on a maintainer decision: no current spec says what reset.css does to native control parts, so a maintainer needs to provide or identify the governing spec for giving a bare file input's button the bare-button look, including that a disabled one then paints like an enabled one, loses the browser's press paint, and keeps the arrow cursor where a bare <button> gets a pointer. An engineering owner records that decision by commenting /approve-spec <full head SHA> on this pull request, and the author may do so as an engineering owner. Independently, two text fixes are needed:

  • Newly live check: the Changeset says the file button now gets "the reset every <button> gets", but it keeps the arrow cursor where a bare <button> gets cursor: pointer (packages/core/src/reset.css lines 263–265), so name what it gets (font, color, border and fill) and say that it keeps the arrow cursor.
  • Newly live check: the description says no current record governs reset.css's declarations, but docs/architecture/theme-compilation.md lists reset.css and its INV19 governs the reset's html font rule, so say instead that no current record governs what the reset does to native control parts.

The rest checks out: the patch [feat] category fits an appearance-only change, the escape restores the browser's look pixel for pixel, Astryx's FileInput renders identically, and the new browser test fails against the old reset.

Claims and files checked

Review mode: full; reason: recipe-changed (many rules)

  • Changeset: the file button gets the reset every bare button gets: false, it keeps the arrow cursor (finding above).
  • Changeset: before, it kept the browser's font stack, text color, 2px outset border and grey fill: verified on the old reset in Chromium.
  • Changeset: it now inherits the input's font and color with no border or fill, and keeps its padding and margin: verified from computed styles on the new reset.
  • Changeset: a disabled file button loses the greyed look, like a disabled bare button: verified.
  • Changeset: Astryx's FileInput looks the same because its native input is hidden: verified (identical frames; the input is clipped to 1×1).
  • Changeset and description: the revert escape restores the browser's look: verified (pixel-identical frames, enabled and disabled).
  • Changeset category: a patch feature fits an appearance-only change with no governing visual record: verified.
  • Description: no current record governs the reset's declarations: false, the theme-compilation record governs its html font rule (finding above).
  • Description: the before and after screenshots, the disabled state, the arrow cursor, light, dark and right to left: verified in Chromium frames.
  • Description: the computed values the browser test compares match a bare button: verified (all 13 match).
  • Description: Safari and WebKit results from before a rebase: stated by the author, not rerun.
  • Description: the browser test passes on the new reset and fails on the old one: verified in Chromium; it also passed in CI at an earlier head.
  • Description: the reset's Chromium contract, unit, until-found and Pages tests and the core typecheck pass: verified (6 contract tests, 20 unit tests, typecheck); the pre-commit checks were not rerun.
  • Description: the merge of main resolved only the Pages manifest hash, and the browser test now imports the shared harness that lint requires: verified.
  • Description: no Astryx component changes, no API change and no internal context: verified (no API rows, no visible file input in any component, no internal references).
  • Description: one product undoes this look today: context, not checkable.
  • .changeset/reset-file-selector-button.md: finding (cursor claim).
  • .github/pages/assets/manifest.json: clear (the hash matches the stylesheet).
  • .github/pages/assets/reset.css: clear (byte-identical to the package reset).
  • packages/core/src/reset.css: on hold for the owner decision; non-blocking comment-length suggestion.
  • packages/core/src/reset.file-selector-button.a11y.browser.spec.ts: clear (fails against the old reset).
  • packages/core/src/reset.file-selector-button.test.ts: clear.

Automated review (maintainer link)

Comment thread packages/core/src/reset.css Resolved
@vjeux

vjeux commented Nov 17, 2026

Copy link
Copy Markdown
Contributor Author

Fixed in 494a49e: the release note names the reset the file button gets and says it keeps the arrow cursor. The description now says no current record governs what the reset does to native control parts.

@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.

Approval waits on an engineering owner's decision: no current spec says what reset.css does to native control parts, so a maintainer (any engineering owner) needs to provide or identify the governing spec for giving a bare file input's button the bare-button look, including that a disabled one then paints like an enabled one, nothing paints on press, and it keeps the arrow cursor where a bare <button> gets a pointer. An engineering owner records that decision by commenting /approve-spec <full head SHA> on this pull request, and the author may do so as an engineering owner.

Both text fixes from the last review landed, and nothing else blocks: the patch [feat] category fits an appearance-only change, the escape restores the browser's look pixel for pixel, Astryx's FileInput renders identically, and the new browser test fails against the old reset.

Claims and files checked

Review mode: incremental; reason: none

  • Changed rules (0): none.
  • Changeset: the file button now gets the font, color, border and fill reset a bare button gets: verified from computed styles on the new reset.
  • Changeset: before, it kept the browser's font stack, text color, 2px outset border and grey fill: verified on the old reset in Chromium.
  • Changeset: it now inherits the input's font and color with no border or fill, and keeps its padding and margin: verified.
  • Changeset: it keeps the arrow cursor where a bare button gets a pointer: verified.
  • Changeset: a disabled file button loses the greyed look, like a disabled bare button: verified.
  • Changeset: Astryx's FileInput looks the same because its native input is hidden: verified (identical frames, enabled and disabled; the input is clipped to 1×1).
  • Changeset and description: the revert escape restores the browser's look: verified (pixel-identical frames, enabled and disabled).
  • Changeset category: a patch feature fits an appearance-only change with no governing visual record: verified; the changeset check passes.
  • Description: no current record governs what the reset does to native control parts, and the stylesheet record covers only its layer: verified.
  • Description: the before and after screenshots, the disabled state, the arrow cursor, light, dark and right to left in Chromium 149: verified in frames from the same engine.
  • Description: the computed values the browser test compares match a bare button: verified (the test compares 13, all match).
  • Description: the escape brings the measured values back to the old reset's, enabled and disabled: verified.
  • Description: WebKit and real Safari results from before a rebase: stated by the author, not rerun.
  • Description: the browser test passes on the new reset and fails on the old one: verified in Chromium.
  • Description: the reset's Chromium contract (6 tests) and its unit, until-found and Pages tests (20) pass: verified.
  • Description: core typecheck passes: verified.
  • Description: the pre-commit checks pass: not rerun.
  • Description: the merge of main resolved only the Pages manifest hash, the browser test imports the shared harness lint requires, and the last commit rewrote the release note and the rule's comment with the Pages copy and hash: verified.
  • Description: no Astryx component changes, no API change and no internal context: verified (no API rows, no visible file input in any component, no internal references).
  • Description: one product undoes this look today: context, not checkable.
  • .changeset/reset-file-selector-button.md: clear.
  • .github/pages/assets/manifest.json: clear (the hash matches the stylesheet).
  • .github/pages/assets/reset.css: clear (byte-identical to the package reset).
  • packages/core/src/reset.css: on hold for the owner decision.
  • packages/core/src/reset.file-selector-button.a11y.browser.spec.ts: clear (fails against the old reset).
  • packages/core/src/reset.file-selector-button.test.ts: clear.

Automated review (maintainer link)

@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.

Approval waits on an engineering owner's decision, not on a change to this pull request.

  • No current record says what reset.css does to native control parts, so an engineering owner needs to provide or identify the governing record for giving a bare file input's button the bare-button look, including that a disabled one then paints like an enabled one and that it keeps the arrow cursor where a bare <button> gets a pointer. Any engineering owner records that decision by commenting /approve-spec <full head SHA> on this pull request, and the author may do so as an engineering owner.

Nothing else blocks: every claim in the release note and the description checks out against the code, the patch [feat] category fits an appearance-only change under the release spec's rule for it, the documented escape restores the browser's look pixel for pixel, Astryx's FileInput renders identically because its native input is clipped away, and the new browser check fails against the old reset and passes against this one. The stylesheet's layer still matches the package-stylesheet record, and no published package gains or loses public API.

Claims and files checked

Review mode: full; reason: merge-touches-pr-files

  • Release note: the file button now gets the font, color, border and fill reset a bare button gets — verified from computed styles on both resets in Chromium 149.
  • Release note: before this, it kept the browser's font stack, button text colour, 2px outset border and grey fill — verified on the base reset.
  • Release note: it now inherits the input's font and colour, has no border or fill, and keeps its own padding and margin — verified (6px padding, 4px margin unchanged).
  • Release note: it keeps the arrow cursor where a bare button gets a pointer — verified.
  • Release note: a disabled file input's button loses the browser's greyed look, as a disabled bare button under the reset already does — verified; both rows now measure identically.
  • Release note: Astryx's FileInput looks the same because its native input is visually hidden — verified from its styles, which clip the input to one pixel.
  • Release note and description: the revert escape keeps the browser's look — verified; the frame is identical to the base frame, enabled and disabled.
  • Changeset category: a patch feature fits an appearance-only change with no governing visual record — verified; the changeset check passes.
  • Description: no current record governs what the reset does to native control parts, and the stylesheet record covers only the layer — verified by reading the current records.
  • Description: the before and after stills were taken against an older main — verified that main's only later change to the reset is the placeholder's dark-mode colour, which those light stills do not show, so they still describe this revision.
  • Description: light, dark and right to left take the input's colour and direction — verified in frames from the same engine.
  • Description: the computed values the browser check compares match a bare button — verified; the check compares thirteen and all match, one more than the description claims.
  • Description: WebKit and real Safari results from before a rebase — stated by the author, not rerun here.
  • Description: the browser check passes on this reset and fails on the old one — verified.
  • Description: the reset's Chromium contract and its unit, until-found and Pages tests pass — verified (six browser tests, twenty-one unit tests).
  • Description: core typecheck passes — verified.
  • Description: the repository checks pass — verified for every check that can run without a version-control index here; three of them shell out to it and could not run.
  • Description: pre-commit checks and coverage — not rerun.
  • Description: one product undoes this look today — context, not checkable.
  • .changeset/reset-file-selector-button.md: clear.
  • .github/pages/assets/manifest.json: clear; the recorded hash matches the stylesheet.
  • .github/pages/assets/reset.css: clear; byte-identical to the package reset.
  • packages/core/src/reset.css: on hold for the owner decision; the rule itself is in the right layer and adds no API.
  • packages/core/src/reset.file-selector-button.a11y.browser.spec.ts: clear; it fails against the old reset.
  • packages/core/src/reset.file-selector-button.test.ts: clear; its first case fails against the old reset.

Automated review (maintainer link)

This branch was successfully deployed

1 active deployment
Preview — 7845c282 Deployed Nov 19, 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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants