Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/mighty-pears-deny.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@primer/react": patch
---

TextInput: Remove redundant `aria-label` attribute from `TextInput.Action` when it already has an `aria-labelledby`.
Original file line number Diff line number Diff line change
Expand Up @@ -2177,7 +2177,6 @@ exports[`TextInput renders trailingAction icon button 1`] = `
className="c3 TextInput-action"
>
<button
aria-label="Icon label"
aria-labelledby=":r1:"
className="c4"
data-block={null}
Expand Down
13 changes: 2 additions & 11 deletions packages/react/src/internal/components/TextInputInnerAction.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,17 +96,8 @@ const TextInputAction = forwardRef<HTMLButtonElement, TextInputActionProps>(
<Box as="span" className="TextInput-action" marginLeft={1} marginRight={1} lineHeight="0">
{icon && !children ? (
<Tooltip direction={tooltipDirection ?? 's'} text={ariaLabel ?? ''} type="label">
<IconButton
variant={variant}
type="button"
icon={icon}
size="small"
sx={sx}
{...rest}
aria-label={ariaLabel as unknown as string}
aria-labelledby={undefined}
ref={forwardedRef}
/>
{/* @ts-ignore we intentionally do add aria-label to IconButton because Tooltip v2 adds an aria-labelledby instead. */}
<IconButton variant={variant} type="button" icon={icon} size="small" sx={sx} {...rest} ref={forwardedRef} />
</Tooltip>
) : (
<ConditionalTooltip aria-label={ariaLabel}>
Expand Down