Skip to content

Commit

Permalink
Set aria-label to title if no label for (#16262)
Browse files Browse the repository at this point in the history
Co-authored-by: Frédéric Collonval <fcollonval@users.noreply.github.com>
  • Loading branch information
fcollonval and fcollonval authored May 1, 2024
1 parent 9ac9069 commit ca4afa1
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions packages/ui-components/src/components/toolbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -843,6 +843,9 @@ export function ToolbarButtonComponent(
}
};

const title = getTooltip();
const disabled = props.enabled === false;

return (
<Button
appearance="stealth"
Expand All @@ -851,14 +854,15 @@ export function ToolbarButtonComponent(
? props.className + ' jp-ToolbarButtonComponent'
: 'jp-ToolbarButtonComponent'
}
aria-disabled={disabled}
aria-label={props.label || title}
aria-pressed={props.pressed}
aria-disabled={props.enabled === false}
{...props.dataset}
disabled={props.enabled === false}
disabled={disabled}
onClick={handleClick}
onMouseDown={handleMouseDown}
onKeyDown={handleKeyDown}
title={getTooltip()}
title={title}
minimal
>
{(props.icon || props.iconClass) && (
Expand Down

0 comments on commit ca4afa1

Please # to comment.