Skip to content

fix(Button): render a real button when nothing is wired - #612

Merged
lorant-one merged 4 commits into
previewfrom
claude/button-role
Nov 25, 2026
Merged

lorant-one merged 4 commits into
previewfrom
claude/button-role

Conversation

@lorant-one

Copy link
Copy Markdown
Member

What

A Button or IconButton with no onClick, href or type used to render a plain div. Screen readers and agents operating the page read it as text. The agent-operate benchmark (#610) showed this with "Delete workspace" in ai/examples/settings.tsx.

It now renders <button type="button">, so it never submits a form by accident. It stays a plain div only inside a control core draws, so no button nests inside another:

  • a clickable Card
  • Kbar's trigger
  • CompareImage's handle
  • an Accordion header

These controls share a new internal InsideControlContext, which is not exported.

The development warnings now cover two cases:

  • An unwired Button inside some other clickable element (one that is not core's) warns that a button is nesting in it.
  • A typeless Button in a <form> still warns that it won't submit.

Checks

  • Full vitest run: 349 files and 4909 tests pass.
  • Typecheck is clean.
  • The old tests that expected a div are updated.
  • New tests cover:
    • real button role and type
    • no form submit
    • staying a div inside Card and Accordion
    • the nested warning
    • the ref
  • I updated gotchas.json, the AI bundles, MIGRATING.md and CHANGELOG (Unreleased).

The element changes from div to button, so I labelled this visual-change. The Compare check covers blocks and examples.


Generated by Claude Code

A Button or IconButton with no onClick, href or type rendered a plain div,
so screen readers and agents read an unwired action as text. It is now a
<button type="button"> everywhere except inside a control core draws
(clickable Card, Kbar trigger, CompareImage handle, Accordion header).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016gNJtwQuhoLQdpygLCVEyk
@lorant-one
lorant-one merged commit ff2af68 into preview Nov 25, 2026
13 of 14 checks passed
@lorant-one lorant-one added the approved label Nov 26, 2026 — with Claude
@lorant-one lorant-one mentioned this pull request Nov 26, 2026
7 tasks done
@lorant-one
lorant-one deleted the claude/button-role branch November 29, 2026 13:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants