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/flat-ears-wink.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@primer/react': patch
---

In `ActionBar`, `aria-label` now gets added to the `role="toolbar"` element.
4 changes: 2 additions & 2 deletions packages/react/src/ActionBar/ActionBar.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ export default meta
type Story = StoryObj<typeof ActionBar>

export const Playground: Story = {
render: args => (
<ActionBar {...args}>
render: ({'aria-labelledby': _, ...args}) => (
<ActionBar {...args} aria-label="Toolbar">
<ActionBar.IconButton icon={BoldIcon} aria-label="Bold"></ActionBar.IconButton>
<ActionBar.IconButton icon={ItalicIcon} aria-label="Italic"></ActionBar.IconButton>
<ActionBar.Divider />
Expand Down
10 changes: 9 additions & 1 deletion packages/react/src/ActionBar/ActionBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,14 @@ const getMenuItems = (
}

export const ActionBar: React.FC<React.PropsWithChildren<ActionBarProps>> = props => {
const {size = 'medium', children, 'aria-label': ariaLabel, flush = false, className} = props
const {
size = 'medium',
children,
'aria-label': ariaLabel,
'aria-labelledby': ariaLabelledBy,
flush = false,
className,
} = props

const [childRegistry, setChildRegistry] = useState<ChildRegistry>(() => new Map())

Expand Down Expand Up @@ -225,6 +232,7 @@ export const ActionBar: React.FC<React.PropsWithChildren<ActionBarProps>> = prop
className={styles.List}
style={{gap: `${ACTIONBAR_ITEM_GAP}px`}}
aria-label={ariaLabel}
aria-labelledby={ariaLabelledBy}
>
{children}
{menuItemIds.size > 0 && (
Expand Down
Loading