Skip to content

docs(Button): in link mode the ref receives the link element; pin today's ref type - #12371

Merged
cixzhang merged 3 commits into
mainfrom
docs/button-href-ref-type
Nov 19, 2026
Merged

cixzhang merged 3 commits into
mainfrom
docs/button-href-ref-type

Conversation

@cixzhang

@cixzhang cixzhang commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Primary intent

Docs and record: say that in link mode (FR11: href and not disabled), Button's ref receives the link element (the anchor, or the link component's element) while its type names HTMLButtonElement, and pin today's type with a test.

User impact

  • Builders using <Button href ref>: the docs now say the ref holds the link element (the anchor, or the link component's element) in link mode (with href and not disabled), so nobody expects button-only APIs on it.
  • No runtime or type change.

Change

  • Button.doc.mjs: a ref entry that leads with the link-mode case, so the first sentence the CLI prints carries it. The rest of the file is unchanged.
  • Button.spec.md FR17: an implementation-gap line ("in link mode (FR11), the ref receives the link element (the anchor, or the link component's element) while the type names HTMLButtonElement"). The FR17 verification row names the type test.
  • New Button.public.test.ts: ButtonProps['ref'] is React.Ref<HTMLButtonElement> | undefined.
  • Changeset [docs] patch for @astryxdesign/core.

Authority

Button FR11 and FR17 already say the ref reaches the rendered root, so the runtime is correct and only the type under-describes it. Widening the type, or splitting it on href, would make valid callers change source (AST-017 FR1), so that stays a separate decision.

Evidence

  • Core typecheck (with the expectTypeOf test), eslint, check:knowledge and check:changesets are clean at main be7f821.

Writing rubric results

  • The record edit adds one gap sentence and names a test in a verification row.
  • It states the system, in the present tense, with no history.

Owner and land path

  • Owner: Astryx maintainers, fix-loop lane 1.
  • Land path: code review, CI, merge.

…type

Button FR11 and FR17 already say the ref reaches the rendered root, which
is the link when href is set. The type still names HTMLButtonElement.
Widening or splitting the type changes public API, so this change records
the mismatch instead: an FR17 gap line, a ref entry in Button's docs, and a
public type test that pins today's type.
@vercel

vercel Bot commented Nov 17, 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 17, 2026 7:48pm UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Nov 17, 2026
@astracat-bot

astracat-bot Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Nov 19, 2026, 9:13 AM UTC

@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec e71eeda

@github-actions

github-actions Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · a5cc79e

Storybook · Sandbox · built from this PR's head

Modified components

Component Size LoC Visual · A11y · RTL
Button · Storybook 65.9 kB (0) · 10.8 kB CSS (0) 841 (0) — · ✓ · ✗

Package size: @astryxdesign/core 7.63 MB packed (+85 B); no new dependencies.

Touched components checked; for the full suites, add ci:run-visual for Visual, ci:run-a11y for Accessibility, ci:run-rtl for RTL.


Generated by PR Enrichment workflow | 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.

Changes requested: one wording fix in the Button record.

  • docs/specs/components/Button/Button.spec.md line 150 says the ref receives the anchor "with href", but FR11 puts Button in link mode only with href and not disabled (a disabled one renders a <button>, whose ref matches its type) and may render a link component instead of an anchor, so please reword it to "in link mode (FR11), the ref receives the link element (the anchor, or the link component's element)" and give the title the same wording.

The new doc entry and the changeset already describe this correctly. Two smaller points: most of the Button.doc.mjs diff is a reformat with identical content, which the description does not mention, and the comment in Button.public.test.ts repeats the shorter wording. The new type test has not been compiled at this head yet, because CI's typecheck was skipped on the draft.

Claims and files checked

Review mode: full; reason: no-earlier-review

  • Claims
    • The docs now say a link-mode ref holds the anchor or the link component's element: verified (Button.doc.mjs:297).
    • No runtime or type change: verified (only a docs data file, a record, a test and a changeset change).
    • Button.doc.mjs adds a ref entry naming the root and the href case: verified (lines 293-298); the rest of the file is reformatted with identical tokens.
    • FR17 gains an implementation-gap sentence: present (Button.spec.md:150), but false for a disabled href Button (the blocking point above).
    • The FR17 verification row names the type test: verified (Button.spec.md:304).
    • The new test pins ButtonProps['ref'] as React.Ref<HTMLButtonElement> | undefined: the assertion is present (Button.public.test.ts:19); not yet compiled at this head.
    • The changeset is a docs patch for @astryxdesign/core: verified.
    • FR11 and FR17 already say the ref reaches the rendered root: verified against the Button record.
    • Widening or splitting the type would make valid callers change source: not checked.
    • Typecheck, lint and the knowledge and changeset checks were clean on the parent commit: not checked (CI skipped at this head).
    • The record edit adds one gap sentence and names a test in a verification row: verified.
  • Files
    • .changeset/button-href-ref-doc.md: clear.
    • docs/specs/components/Button/Button.spec.md: line 150 blocking; line 304 clear.
    • packages/core/src/Button/Button.doc.mjs: clear (the new entry matches FR11; the reformat is a no-op).
    • packages/core/src/Button/Button.public.test.ts: comment wording note; compile result pending CI.

Automated review (maintainer link)

…formatting

The FR17 gap line and the type test's comment now say that in link mode
(FR11) the ref receives the link element, the anchor or the link
component's element. A disabled Button with href renders a button, whose
ref matches its type. Button.doc.mjs keeps its existing formatting; only the
ref entry is added.
@cixzhang cixzhang changed the title docs(Button): with href the ref receives the anchor; pin today's ref type docs(Button): in link mode the ref receives the link element; pin today's ref type Nov 17, 2026
@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Nov 17, 2026
@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec f4a1bb8

@github-actions github-actions Bot removed the needs:spec-owner-review Current knowledge records await owner approval 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.

Changes requested: one wording fix in the changeset.

  • Miss: .changeset/button-href-ref-doc.md line 5 says the docs describe the ref receiving the anchor "with href", but the doc entry and FR11 limit that to link mode (a disabled href Button renders a <button>, whose ref matches its type), so please reword it to "in link mode (with href and not disabled)" and give the description's User impact bullet the same wording.

The record line, title, doc entry and test comment match FR11, and the new type test compiles under Core's typecheck at this head. One optional point: astryx component Button prints only each prop's first sentence, so the new row reads "Ref to the root element." there, and leading with the link-mode clause would put it in that view.

Claims and files checked

Review mode: same-head; reason: none

  • Claims
    • Changeset: the docs now list ref and say that with href the ref receives the anchor or the link component's element, although the type names HTMLButtonElement: false as worded: the doc entry limits it to href and not disabled (Button.doc.mjs:226), and a disabled href Button renders a <button> (Button.tsx:924); the blocking point above.
    • Changeset: no runtime or type change: verified: the change is a docs data entry, a record edit, a type test and a changeset; the ref type is unchanged (Button.tsx:375).
    • Changeset: a docs patch for @astryxdesign/core: verified; the changeset check passes at this head.
    • Primary intent: in link mode (href and not disabled) the ref receives the link element while its type names HTMLButtonElement: verified (Button.tsx:924, :1161-1162, :375).
    • User impact: the docs say the ref holds the link element when href is set: false as worded, the same gap as the changeset; the doc entry itself is correct.
    • No runtime or type change: verified.
    • The doc file adds a ref entry naming the root and the link-mode case, and the rest of the file is unchanged: verified (+6/-0, Button.doc.mjs:222-227).
    • The record's FR17 gains the link-mode gap line: verified (Button.spec.md:150).
    • The FR17 verification row names the type test: verified (Button.spec.md:304).
    • The new test pins ButtonProps['ref'] as React.Ref<HTMLButtonElement> | undefined: verified (Button.public.test.ts:19-21): it compiles under Core's typecheck, and a widened type fails the same assertion.
    • FR11 and FR17 already say the ref reaches the rendered root: verified against the Button record.
    • Widening the type, or splitting it on href, would make valid callers change source: verified with a type probe: a ref forwarded to a native <button>, and a button ref passed with href, each stop compiling.
    • Core typecheck with the new test, lint, the knowledge check and the changeset check are clean: verified at this head.
    • Writing rubric: one gap sentence and a test name in a verification row, in the present tense with no history: verified.
  • Files
    • .changeset/button-href-ref-doc.md: line 5 blocking.
    • docs/specs/components/Button/Button.spec.md: clear (lines 150 and 304).
    • packages/core/src/Button/Button.doc.mjs: clear; one non-blocking note on the CLI's first-sentence view.
    • packages/core/src/Button/Button.public.test.ts: clear.

Automated review (maintainer link)

Comment thread .changeset/button-href-ref-doc.md Resolved
Comment thread packages/core/src/Button/Button.doc.mjs Resolved
The changeset now says link mode (with href and not disabled). The ref
entry leads with the link-mode clause, so the first sentence the CLI prints
carries it.
@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec a5cc79e

@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 started on this head when the pull request left draft and has not finished yet.

The code is unchanged since the last review: the doc entry, the FR17 gap line, the type pin and the changeset all describe the ref in link mode, with href and not disabled, as FR11 does.

Claims and files checked

Review mode: same-head; reason: none

  • Claims
    • Changeset: Button's docs now list ref: verified (Button.doc.mjs:222-227).
    • Changeset: in link mode (with href and not disabled) the ref receives the anchor or the link component's element, although its type names HTMLButtonElement: verified (Button.tsx:924, :1161-1162, :375).
    • Changeset: no runtime or type change: verified: the built API surface of Core and the themes is identical before and after, and no runtime file changes.
    • Changeset: a docs patch for @astryxdesign/core: verified; the changeset check passes at this head.
    • Title and primary intent: in link mode the ref receives the link element while its type names HTMLButtonElement, and today's type is pinned: verified (Button.tsx:924, :1161-1162, :375; Button.public.test.ts:19-21).
    • User impact: the docs say the ref holds the link element in link mode, with href and not disabled: verified (Button.doc.mjs:226).
    • No runtime or type change: verified, as for the changeset.
    • The doc entry leads with the link-mode case, so the first sentence the CLI prints carries it, and the rest of the file is unchanged: verified: the default component view prints the whole row, and the file only gains the six-line entry.
    • The record's FR17 gains the link-mode gap line, and its verification row names the type test: verified (Button.spec.md:150, :304).
    • The new test pins ButtonProps['ref'] as React.Ref<HTMLButtonElement> | undefined: verified: it compiles under Core's typecheck, and the same assertion over a widened type fails.
    • FR11 and FR17 already say the ref reaches the rendered root: verified against the Button record, which reads the same on main today.
    • Widening the type, or splitting it on href, would make valid callers change source: verified with a type probe: a ref forwarded to a native <button>, and a button ref passed with href, each stop compiling.
    • Core typecheck with the new test, lint, the knowledge check and the changeset check are clean: verified at this head; the Lint workflow also passes here.
    • Writing rubric: one gap sentence and a test name in a verification row, in the present tense with no history: verified.
  • Files
    • .changeset/button-href-ref-doc.md: clear.
    • docs/specs/components/Button/Button.spec.md: clear.
    • packages/core/src/Button/Button.doc.mjs: clear.
    • packages/core/src/Button/Button.public.test.ts: clear.

Automated review (maintainer link)

@cixzhang
cixzhang marked this pull request as ready for review November 19, 2026 08:53
@cixzhang
cixzhang merged commit d3e41c1 into main Nov 19, 2026
148 checks passed
@github-actions
github-actions Bot deleted the docs/button-href-ref-type branch November 20, 2026 06:05

This branch was successfully deployed

1 active deployment
Preview — a5cc79e4 Deployed Nov 17, 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.

1 participant