Skip to content

Commit

Permalink
fix(IconButton) - Add all missing arias to match < Button /> arias
Browse files Browse the repository at this point in the history
  • Loading branch information
rivka-ungar committed May 20, 2024
1 parent f384d7c commit 0cab687
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions packages/core/src/components/IconButton/IconButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,27 @@ export interface IconButtonProps extends VibeComponentProps {
* Icon to be rendered
*/
icon?: SubIcon;
/**
* element id to describe the button accordingly
* */
ariaLabeledBy?: string;
/**
* a11y property to be added, used for screen reader to know what kind of button it is
*/
ariaLabel?: string;
/**
* aria for a button popup
*/
ariaHasPopup?: React.HTMLProps<HTMLButtonElement>["aria-haspopup"];
/**
* a11y property to be added, used for screen reader to know if the button is expanded
*/
ariaExpanded?: boolean;
/**
* aria controls - receives id for the controlled region
*/
ariaControls?: string;
"aria-describedby"?: AriaAttributes["aria-describedby"];
/**
* a11y property to be added, used for screen reader to know if the button is hidden
*/
Expand Down Expand Up @@ -106,8 +119,12 @@ const IconButton: VibeComponent<IconButtonProps> & {
size = IconButton.sizes.MEDIUM,
tooltipProps = {} as TooltipProps,
tooltipContent,
ariaLabeledBy,
ariaLabel,
ariaHasPopup,
ariaExpanded,
ariaControls,
"aria-describedby": ariaDescribedBy,
"aria-hidden": ariaHidden,
hideTooltip = false,
kind = IconButton.kinds.TERTIARY,
Expand Down Expand Up @@ -190,8 +207,12 @@ const IconButton: VibeComponent<IconButtonProps> & {
disabled={disabled}
color={color}
kind={kind}
ariaLabeledBy={ariaLabeledBy}
ariaLabel={buttonAriaLabel}
ariaHasPopup={ariaHasPopup}
ariaExpanded={ariaExpanded}
ariaControls={ariaControls}
aria-describedby={ariaDescribedBy}
aria-hidden={ariaHidden}
ref={mergedRef}
id={id}
Expand Down

0 comments on commit 0cab687

Please sign in to comment.