Forward a shared set of button props across the *Button components - #438
Merged
Conversation
ChatSendButton was a closed props interface with no passthrough, so consumers could not attach `aria-describedby`, `aria-keyshortcuts`, `id`, `form`, or focus/keyboard handlers to it. ChatScrollButton had the opposite problem: it extended `ComponentPropsWithoutRef<'div'>` and spread arbitrary DOM props onto its wrapper. Introduce `ButtonPassthroughProps`, a curated `Pick` of `ButtonProps` covering identity, description, and interaction, and extend every button-like component with it so they all forward the same set to the button they render. Button itself gains the two members it was missing (`id`, `onFocus`); ActionElement already spread unlisted props, so it only needed the `onFocus` type. ChatScrollButton now forwards to the inner Button rather than the wrapper div, since that is the interactive element the props describe. Fixes #371 Claude-Session: https://claude.ai/code/session_01XFkkvUQfynGRedEYDNxKoY
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This was referenced Aug 6, 2026
czarandy
added a commit
that referenced
this pull request
Aug 6, 2026
The eight Chat components outside the button pair still extended ComponentPropsWithoutRef and spread `...rest` onto their root, so they accepted the whole DOM prop surface — including props that fight their own contract (`role`, `aria-live`, `data-sender`) with no indication which one wins. Introduce `ChatPassthroughProps` — id plus the three aria naming and description attributes — and extend each component with it, mirroring `ButtonPassthroughProps` from #438. ChatComposerInput is a textarea, so it adds the text-input props a chat composer actually needs on top: autoComplete, enterKeyHint, maxLength, name, onBlur, onFocus, onPaste, and onKeyDown (which the component already consumed but only declared via the wide extension). Two behavior fixes fall out of the narrowing: - ChatMessage spread `...rest` before its generated `aria-label` / `aria-labelledby`, so a consumer label was silently dropped. The consumer's value now wins and falls back to the generated one. - ChatMessageList hardcoded `aria-live="polite"` with no way to opt out; it is now a prop defaulting to `polite`. Fixes #439 Claude-Session: https://claude.ai/code/session_01XFkkvUQfynGRedEYDNxKoY
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #371.
ChatSendButtonhad a closed props interface with no passthrough, so nothing beyondclassName/style/ref/data-testidreached the renderedButton.ChatScrollButtonhad the opposite problem — it extendedComponentPropsWithoutRef<'div'>and spread arbitrary DOM props onto its wrapper.Rather than opening either one up to all element props, this adds a curated set and applies it to every
*Buttoncomponent so they behave consistently with the regularButton.ButtonPassthroughPropsA
PickofButtonPropscovering identity, description, and interaction:Deriving from
ButtonProps(the idiomCopyButtonalready used) keeps the components tied toButton's curated API — a prop is only forwardable ifButtondocuments it.Changes
Button— gains the two members of that set it was missing:idandonFocus.ActionElementalready spread unlisted props onto both the<button>and link branches, so it only needed theonFocustype.ChatSendButton— extendsButtonPassthroughProps, forwarded ahead of the contract props it sets itself (icon,label,onClick,variant).ChatScrollButton— narrowed fromComponentPropsWithoutRef<'div'>to the same set. It now forwards to the innerButtonrather than the wrapperdiv, since that is the interactive element these props describe.className/style/data-testid/refstill target the wrapper as before.CopyButton,ToggleButton,SplitButton— same set added.SplitButtonforwards to the primary action button, not the menu toggle.Note on
titletitlewas on the issue's list but is deliberately not included.Buttonalready has atooltipprop that renders the styledTooltip, and icon-only buttons get one by default — so a nativetitlewould show a second browser tooltip on top of it. Happy to add it if you'd rather have the native attribute available.Tests
A regression test per component asserting the props land on the rendered button, plus a
Buttontest coveringid/onFocuson both the button and link renderings. Thearia-describedbyassertions usestringContainingbecauseTooltipappends its own description id alongside the consumer's — verified the consumer's value survives rather than being replaced.Full suite passes (3185 tests), lint/typecheck/format clean.
https://claude.ai/code/session_01XFkkvUQfynGRedEYDNxKoY