Skip to content

spec(AST-089): style the public ref element, otherwise the outermost root - #7931

Merged
cixzhang merged 4 commits into
mainfrom
spec/ref-first-dom-style-props
Nov 6, 2026
Merged

cixzhang merged 4 commits into
mainfrom
spec/ref-first-dom-style-props

Conversation

@imdreamrunner

@imdreamrunner imdreamrunner commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Exact decision needed

Should accepted style, className, and xstyle target the component's public DOM ref element by default, using its unique outermost owned DOM element only when the public API exposes no unprefixed ref?

This is the ref-first alternative to #6066. Both PRs are independent branches containing alternative versions of the same spec:AST-089 record. Choose one; do not merge both.

Existing authority searched

The canonical owner remains architecture:public-component-api. This cross-component draft records a candidate decision for that owner, not parallel current authority. AST-032 remains the existing upload/send icon specification; both styling alternatives use AST-089.

Decision

Draft, pending explicit owner approval: every accepted general styling prop reaches the element promised by the unprefixed public DOM ref. If and only if the API exposes no unprefixed ref, it reaches the unique outermost owned DOM root.

“No ref” is an API condition, not a caller omitting ref, passing null, or observing ref.current === null. Callback/object refs, mounting, and closed surfaces never move styling. Internal and named part refs do not choose the target. An imperative, ambiguous, or exposed-but-dropped ref is not an absent ref and cannot silently activate fallback.

Existing divergences are explicit component/path/style-target/ref-target exemptions. They preserve only the stated default-target divergence, not unrelated forwarding defects or existing authority violations. New divergence paths do not inherit them. Named parts, semantic targets, and the current input-family root-styling prohibition stay intact.

Rejected alternatives

  • Runtime ref-presence fallback: passing a ref or opening a surface must not move styling.
  • Immediate target moves, new ref APIs, or prop removal for existing divergence: keep explicit compatibility exemptions instead.
  • Outermost-first remains the separate candidate in spec(AST-089): require outermost DOM styling target with exemptions #6066, not a decision rejected by this draft.

Claim scope and non-goals

Specification only. No runtime code, public types, ref targets, themes, component rendering, or Changeset changes. No component migration, new styling part, registry algorithm, or CI topology is prescribed. authority: draft, phase: proposed, and approval fields remain unset; current records continue to govern.

Evidence and implementation relationship

The two independent export walks agree on 615 runtime name/source identities. The source audit covers 205 exported component/provider names, 477 source-path records, and 555 pinned files byte-verified at the reviewed main baseline 0c1a6e860cb0b11d03767ee302c6d22ef0350e94, including 32 names absent from the CLI roster. The record includes scoped style/ref target-preservation exemptions and separate legacy styling/ref-identity enforcement exemptions. Fully empty renders are not exemptions by themselves. InputGroup's current FR10 scope tension and Timer's conflicting current wrapper/root claims remain explicit owner questions.

The branches are refreshed onto main 13df1cecf72ae1e4ed3787d7af59541d57532474. The three intervening palette-generation, Carousel-focus, and trigger-menu-announcement changes were inspected; they do not change the exported component inventory or styling/ref/root targets, so the exemption list remains current through that base.

The exemption table is a compatibility contract, not a waiver of implementation debt under an already-current owner. Detailed discussion and source audit remain outside the standing record. Ref API changes also need styling compatibility review when they would change the default target. Promotion projects the selected rule and exemption boundary into affected current owner surfaces together.

Writing rubric results

  • R1 narration: the record states present-tense target selection, fallback, and compatibility behavior; proposal comparisons stay here.
  • R2 research in the record: comparison and source audit stay outside the record; its table specifies only retained targets and scoped compatibility exemptions.
  • R3 evidence naming a change: verification names public ref/DOM identity, types, owning contracts, and compatibility evidence rather than a PR or commit.
  • R4 rejected alternatives over one line or outside a decision: two one-line guardrails, each inside its decision.
  • R5 pull request or issue references remaining: none in the record.
  • R6 ruled open questions still listing options: source-derived target facts are not open questions; default selection and the explicit InputGroup/Timer current-authority tensions remain genuinely open.

Scope

  • This PR contains specification records only.
  • It records observable behavior and preserves equivalent internal implementations.
  • Verification states evidence layers and failure signals without CI topology.
  • It records one target decision, including its inseparable compatibility boundary.
  • Canonical ownership, affected current claims, and overlapping work are named.
  • Adjacent API, visual, accessibility, and implementation behavior stays outside scope.
  • Public text contains no private operational context.

Validation

  • pnpm check:knowledge — passed.
  • Prettier and git diff --check — passed.
  • pnpm lint:strict — passed on this proposal.
  • Focused knowledge and record-lookup tests — 153 passed.
  • Independent semantic/spec-writing review; initial and final table corrections incorporated, including empty-render semantics, directly-DOM-valued-ref boundaries, CommandPalette's inline ref-proof gap, and Table's retained semantic-table identity.
  • Refreshed-base checks at 13df1cecf72ae1e4ed3787d7af59541d57532474: strict lint and full package build passed; 153 focused knowledge/lookup tests and 131 Carousel/ChatComposerInput tests passed. The newly landed changes do not alter the exemption inventory.
  • Unmodified source baseline: full pnpm build and strict lint passed. Full pnpm test recorded 26,195 passing / 549 failing tests across 141 failed files, predominantly timeout/CLI-runner failures, before any proposal file was added. Representative isolated rerun: 65/65 passed. These are baseline evidence, not a claim that the full suite is green.

No Changeset: specification only. No browser screenshots are required because nothing rendered or interactive changes; any future target migration owes its own relevant runtime and browser evidence.

@vercel

vercel Bot commented Oct 22, 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 6, 2026 2:21pm UTC

Request Review

@astracat-bot

astracat-bot Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Nov 6, 2026, 2:27 PM UTC

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Oct 22, 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 draft lays out the ref-first styling default clearly, but approval waits on an engineering owner's decision: FR1–FR5, FR7, DEC-1 and DEC-2 add requirements no current record states, and an engineering owner records that decision by commenting /approve-spec 472e177f405a6ad98549f924da2f185e0b3d1023 on this pull request (the author may do so if they are an engineering owner). Whichever way that goes, the record needs a refresh against current main:

  • E6 and E7 do not cover the sheet presentations that component:Popover DEC-8 and component:PowerSearch DEC-3 now specify, so FR7 would leave both paths unexempted.
  • Current-state impact should name architecture:public-component-api INV15 and spec:AST-071 FR1, which describe the unprefixed styling set as the root's.
  • L7 should say VisuallyHidden's xstyle is ignored, as component:VisuallyHidden FR3 now records.
  • FR1 should state that components bound by family:input-fields FR10 are outside the default, including root styling they still accept until FR10 lands.

[Automated review]

Comment on lines +41 to +46
- **FR1 — Public DOM ref first.** A stable Core web component that accepts any of
`style`, `className`, or `xstyle` and exposes an unprefixed DOM `ref` MUST apply
every accepted general styling prop to the element promised by that ref's
public contract on every supported render path, except for the explicit
compatibility exemptions below. The target MAY be an inner control or a sole
detached surface; DOM ancestry does not override a valid public ref target.

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.

FR1's only carve-out is the exemption tables. Field-composed components that still accept root styling until family:input-fields FR10 lands split it from their ref (that record's prop-target table: Selector styles the control box with base props on the trigger button; Slider styles Field with ref on the track), and none is listed, so FR1 read literally asks for their root styling on the ref element. Saying here or in FR6 that FR10-bound components are outside the default would close that.

Comment on lines +121 to +125
The canonical shared API owner is `architecture:public-component-api`, whose
INV5 and INV6 preserve styling on the documented contract element and composition,
and whose INV8 preserves the documented ref target. They do not require styling
and ref targets to be the same element. These current claims remain authoritative
while this record is draft.

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.

INV5, INV6 and INV8 are not the only current claims involved: architecture:public-component-api INV15 and spec:AST-071 FR1 describe part sets as styling for elements other than the root, and INV6 and family:input-fields FR10 call the unprefixed set root styling inputs. FR1's inner-control target needs those named here as claims promotion amends.

| E3 | Horizontal Stepper, expanded or compact | Horizontal frame `div` / ordered-list `ol` | Preserve frame styling and list measurement/ref identity; `component:Stepper`. Vertical list-target styling needs no target exemption. |
| E4 | Timestamp and Timer, supported rendered temporal states | Outer Text `span` / inner `time` | Preserve the existing temporal wrapper rather than moving general styles to `time`. `component:Timer` FR5/ORD2 and temporal component/shared API owners describe the seam; Timer's broader current timer-system wording remains an unresolved authority tension in OQ3. |
| E5 | ContextMenu and MoreMenu pointer/sheet paths | Inner menu/content `div` / trigger wrapper or trigger button | Existing general styles describe the menu, not its trigger. Shared API and menu owners retain that target; existing sheet ref-forwarding debt is not waived. |
| E6 | DropdownMenu pointer/sheet; Popover automatic/custom/external-anchor; HoverCard text/element/fragment-trigger paths | DropdownMenu inner menu `div`, Popover inner painted `div`, or HoverCard floating `div` / no unprefixed component ref | There is no unique outermost fallback across trigger, persistent template, host, and surface trees. Named/payload refs are not a component `ref`. `component:Popover` owns painted-surface styling; respective menu/HoverCard and shared API owners retain the other targets. |

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.

component:Popover on main now has a presentation option (DEC-6), and DEC-8 says the sheet's panel takes xstyle, className and style. This row lists only the automatic, custom and external-anchor paths, so under FR7 the sheet path is an unlisted divergence.

| E4 | Timestamp and Timer, supported rendered temporal states | Outer Text `span` / inner `time` | Preserve the existing temporal wrapper rather than moving general styles to `time`. `component:Timer` FR5/ORD2 and temporal component/shared API owners describe the seam; Timer's broader current timer-system wording remains an unresolved authority tension in OQ3. |
| E5 | ContextMenu and MoreMenu pointer/sheet paths | Inner menu/content `div` / trigger wrapper or trigger button | Existing general styles describe the menu, not its trigger. Shared API and menu owners retain that target; existing sheet ref-forwarding debt is not waived. |
| E6 | DropdownMenu pointer/sheet; Popover automatic/custom/external-anchor; HoverCard text/element/fragment-trigger paths | DropdownMenu inner menu `div`, Popover inner painted `div`, or HoverCard floating `div` / no unprefixed component ref | There is no unique outermost fallback across trigger, persistent template, host, and surface trees. Named/payload refs are not a component `ref`. `component:Popover` owns painted-surface styling; respective menu/HoverCard and shared API owners retain the other targets. |
| E7 | PowerSearch when the nested Tokenizer Field box renders | Nested Field box through Tokenizer's `container*` inputs / outer PowerSearch wrapper | Preserve the higher-level composition's current styling projection. Where the Field box is absent, the part has no effect and warns, never reroutes. `component:PowerSearch`, `component:Tokenizer`, and the input-family part contract; no root styling is added to Tokenizer. |

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.

component:PowerSearch DEC-3 on main specifies a sheet presentation where ref reaches the root and the styling set reaches the field container, and records that family:input-fields FR10 now binds PowerSearch. This row covers only the nested Tokenizer Field box.

| L4 | SideNav content-bearing drawer-content paths | All accepted general styling inputs and the public ref are dropped | Shared API INV5/INV6/INV8; a conditional footer root does not repair the loss. |
| L5 | TypeaheadItem's nonempty caller `item.element` path | Accepted general styling and public ref are not applied to the returned caller node | Shared API INV5/INV6/INV8; arbitrary caller output is not a guaranteed forwarder. |
| L6 | SegmentedControlItem | Accepted `className` is overwritten; dynamic StyleX output can overwrite the entire accepted inline `style` | Shared API INV5/INV6; this is lost styling, not a permissible split or precedence decision. |
| L7 | VisuallyHidden's accepted inherited `xstyle`, intrinsic and custom paths | `xstyle` is leaked/uninterpreted rather than applied to its ref element; `className` and `style` are not accepted | Shared API/AST-071 obligations and the styling-free intention require reconciliation; the exemption does not create styling support. |

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.

On main, VisuallyHidden strips xstyle before spreading its props, and component:VisuallyHidden FR3 records it as ignored rather than leaked.

…the bound TopNavMenu drawer-header ref, and words Icon's split

BottomSheetSwitcher applies its dialog surface to every step's sheet
dialog, so it joins the target-preservation exemptions. TopNavMenu and
TopNavMegaMenu drawer headers bind their ref, so L10 keeps only SideNav.
Icon styles its span and binds its ref to the svg.
@cixzhang

cixzhang commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

/approve-spec 7c17861

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

The ref-first direction is owner-approved for this head, but the record still misdescribes or omits several current specs, so it needs these corrections before it lands:

  • E6 and E7 do not cover the sheet presentations that component:Popover DEC-8 and component:PowerSearch DEC-3 specify, so under FR7 their styling targets become unexempted divergences.
  • Current-state impact should name architecture:public-component-api INV15 and spec:AST-071 FR1, which treat styling for a non-root element as a part set and change under FR1.
  • L7 should say VisuallyHidden's xstyle is ignored, as component:VisuallyHidden FR3 records, rather than leaked.
  • FR1 or FR6 should state that components bound by family:input-fields FR10 are outside the default, including the root styling they still accept until FR10 lands.
  • L8 should say Icon's ref reaches the svg (component:Icon FR8) and its styled wrapper is unpromised implementation (AV2), rather than calling the split Icon's current contract.

With the owners' choice made, OQ1 can collapse into DEC-1 under the writing rubric's R6.

[Automated review]

| L5 | TypeaheadItem's nonempty caller `item.element` path | Accepted general styling and public ref are not applied to the returned caller node | Shared API INV5/INV6/INV8; arbitrary caller output is not a guaranteed forwarder. |
| L6 | SegmentedControlItem | Accepted `className` is overwritten; dynamic StyleX output can overwrite the entire accepted inline `style` | Shared API INV5/INV6; this is lost styling, not a permissible split or precedence decision. |
| L7 | VisuallyHidden's accepted inherited `xstyle`, intrinsic and custom paths | `xstyle` is leaked/uninterpreted rather than applied to its ref element; `className` and `style` are not accepted | Shared API/AST-071 obligations and the styling-free intention require reconciliation; the exemption does not create styling support. |
| L8 | Icon's registry-rendered path; CheckIndicator's checked-glyph path | Icon: styling reaches the rendered span and the public ref binds its svg (styling on the span, ref on the svg); CheckIndicator: styling reaches the rendered span, but the accepted public ref is not forwarded there | Exclusion from the new style/ref-identity proof only. Icon's split is its current contract, not a new span-ref promise; CheckIndicator's unforwarded ref is no INV8 waiver. Replacement/custom paths are separately scoped. |

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.

component:Icon promises only the svg ref (FR8); AV2 says its internal wrapper is not public anatomy, and its anatomy "intentionally does not promise a span". FR7 also calls listed splits "not valid replacement contracts". Saying Icon's ref target is FR8's svg and its styled wrapper is unpromised implementation would keep L8 consistent with both.

| L4 | SideNav content-bearing drawer-content paths | All accepted general styling inputs and the public ref are dropped | Shared API INV5/INV6/INV8; a conditional footer root does not repair the loss. |
| L5 | TypeaheadItem's nonempty caller `item.element` path | Accepted general styling and public ref are not applied to the returned caller node | Shared API INV5/INV6/INV8; arbitrary caller output is not a guaranteed forwarder. |
| L6 | SegmentedControlItem | Accepted `className` is overwritten; dynamic StyleX output can overwrite the entire accepted inline `style` | Shared API INV5/INV6; this is lost styling, not a permissible split or precedence decision. |
| L7 | VisuallyHidden's accepted inherited `xstyle`, intrinsic and custom paths | `xstyle` is leaked/uninterpreted rather than applied to its ref element; `className` and `style` are not accepted | Shared API/AST-071 obligations and the styling-free intention require reconciliation; the exemption does not create styling support. |

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.

On main, VisuallyHidden strips xstyle before spreading its props, and component:VisuallyHidden FR3 records it as ignored rather than leaked.

…tions, names the claims promotion amends, and collapses OQ1

E6 and E7 add the sheet paths of component:Popover DEC-8 and
component:PowerSearch DEC-3. FR6 puts input-fields FR10 components outside
the default. Current-state impact names public-component-api INV15 and
AST-071 FR1. L7 says VisuallyHidden ignores xstyle; L8 says Icon's ref
reaches the svg and its wrapper is unpromised. OQ1's choice moves into DEC-1.
@cixzhang
cixzhang marked this pull request as draft November 6, 2026 14:14
@cixzhang

cixzhang commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

/approve-spec 0b36a6b

@cixzhang
cixzhang marked this pull request as ready for review November 6, 2026 14:16

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

Approved pending CI: CI has not finished on this head yet.

The ref-first default is owner-approved for this head, and every correction from the previous review is in: E6 and E7 cover the Popover and PowerSearch sheet presentations, Current-state impact names the claims promotion amends, FR6 puts FR10-bound components outside the default, and L7 and L8 now match the VisuallyHidden and Icon records.

  • The description still says outermost-first is not rejected by this draft and reports R4 and R6 for the record before OQ1 was folded into DEC-1; updating those lines keeps the description in step with the record.

#6066 carries the outermost-first version of the same spec:AST-089 record, so it should not also land.

[Automated review]

@cixzhang
cixzhang merged commit 2fbf324 into main Nov 6, 2026
105 checks passed
@github-actions
github-actions Bot deleted the spec/ref-first-dom-style-props branch November 7, 2026 06:03

This branch was successfully deployed

1 active deployment
Preview — 0b36a6b1 Deployed Nov 6, 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants