Skip to content

ui-kit: conversation feedback, suggestion, answer, file, toast and attachment controls render span role=button #2760

Open

Description

@schlessera

Context

Part of #2586 (sub-epic under #2576). The maintainer ruling (2026-10-22) makes every actionable kit control a native <button type="button">: no div/span role="button", no own tabIndex (unless roving) and no hand-written Enter/Space handler. A button never contains interactive content. Disabled actionable controls stay focusable and announced (aria-disabled), and ignore activation. That shares #1474's ariaDisabled focus and announcement, but not its activation: #1474's ariaDisabled Button forwards the tap to the caller's onClick so it can explain, whereas these controls print their reason (why, blockedWhy) and ignore the tap. The difference is intentional per the ruling's own wording ("activation is ignored", "inert on activation").

Guide html/html: "DO use <button> for triggered actions (JS, Modals, Forms) … Set type="button" for non-submit buttons".

Controls: FeedbackRow up/down (packages/ui-kit/src/blocks/FeedbackRow.tsx:132, :144), SuggestionChips (packages/ui-kit/src/conversation/SuggestionChips.tsx:214; its disabled chip already ignores activation while focusable, :53-56), StreamingAnswer (packages/ui-kit/src/conversation/StreamingAnswer.tsx:198), RelatedFiles (packages/ui-kit/src/conversation/RelatedFiles.tsx:141), InlineToast (packages/ui-kit/src/conversation/InlineToast.tsx:161) and AttachmentRow (packages/ui-kit/src/conversation/AttachmentRow.tsx:144).

Scope

  • Migrate these six conversation components' actionable elements to native buttons.
  • SuggestionChips keeps its focusable, announced, activation-ignoring disabled chip and its why text.
  • Replace selectors that target these controls by role.

Out of scope

Acceptance criteria

  • Each migrated control renders a native <button type="button"> with no own tabIndex (unless roving) and no Enter/Space handler, keeping tabStop/roving behaviour. Activation fires once per click, Enter or Space.
  • Disabled states (where the component has one) stay focusable, announce aria-disabled, and ignore click, Enter and Space.
  • [role="button"] selectors in packages/ui-*/src and tests that target this child's components are replaced with button selectors or data- hooks.
  • A real-browser test per migrated component asserts the native element and single activation, and fails on the current tree. A mutation that re-adds a manual Enter handler shows double activation. Record both runs in the PR.
  • Visual baselines are unchanged in both themes, and every 44px reach assertion (D34) passes.

Verification

node scripts/visual.mjs
bun run test packages/ui-kit packages/ui-react
bun run typecheck
bun run lint
bun run check:pr --base origin/main

Contract impact

  • This touches the integration contract, so it needs the contract label, a CONTRACT: commit prefix, and the doc updated in the same commit. Not expected: the ruling needs no new forwarded refs or prop changes, and existing public prop shapes and meanings are preserved. If implementation finds a necessary supported prop/ref or documented semantic change, classify it under docs/decisions/contract-versioning.md and add contract/breaking before code is written; pre-1.0 an approved break ships as a minor changeset naming it.
  • This changes a published package's behaviour, so it needs a changeset (@schlessera/brain-ui-kit, plus @schlessera/brain-ui-react where it changes).

2026-10-24: filed from #2586 when it became a sub-epic, following the ruling's suggested split.

Activity

  1. added
    type: refactor
    area: ui-kit
    priority: p3
    agent-ready
    on Oct 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent-readyarea: ui-kitpriority: p3type: refactor

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions