Skip to content
Open
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
17 changes: 15 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,15 @@ export default meta
type Story = StoryObj<typeof ActionBar>

export const Playground: Story = {
render: ({'aria-labelledby': _, ...args}) => (
<ActionBar {...args} aria-label="Toolbar">
args: {
overflowLabel: 'More item',
size: 'medium',
flush: false,
gap: 'condensed',
},

render: ({'aria-labelledby': _, overflowLabel, ...args}) => (
<ActionBar {...args} overflowLabel={overflowLabel} aria-label="Toolbar">
<ActionBar.IconButton icon={BoldIcon} aria-label="Bold"></ActionBar.IconButton>
<ActionBar.IconButton icon={ItalicIcon} aria-label="Italic"></ActionBar.IconButton>
<ActionBar.Divider />
Expand All @@ -48,11 +55,17 @@ Playground.argTypes = {
description: 'Horizontal gap scale between items',
table: {defaultValue: {summary: 'condensed'}},
},
overflowLabel: {
control: {type: 'text'},
description: 'Accessible label for the overflow menu button',
table: {defaultValue: {summary: 'More items'}},
},
}
Playground.args = {
size: 'medium',
flush: false,
gap: 'condensed',
overflowLabel: 'More items',
}

export const Default = () => (
Expand Down
9 changes: 8 additions & 1 deletion packages/react/src/ActionBar/ActionBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,12 @@ export type ActionBarProps = {
* @default 'condensed'
*/
gap?: GapScale

/**
* Accessible label for the overflow menu button
* @default "More items"
*/
overflowLabel?: string
} & A11yProps

export type ActionBarIconButtonProps = {disabled?: boolean} & IconButtonProps
Expand Down Expand Up @@ -297,6 +303,7 @@ export const ActionBar: React.FC<React.PropsWithChildren<ActionBarProps>> = prop
flush = false,
className,
gap = 'condensed',
overflowLabel
} = props

// We derive the numeric gap from computed style so layout math stays in sync with CSS
Expand Down Expand Up @@ -400,7 +407,7 @@ export const ActionBar: React.FC<React.PropsWithChildren<ActionBarProps>> = prop
{menuItemIds.size > 0 && (
<ActionMenu>
<ActionMenu.Anchor>
<IconButton variant="invisible" aria-label={`More ${ariaLabel} items`} icon={KebabHorizontalIcon} />
<IconButton variant='invisible' aria-label={overflowLabel ?? "More items"} icon={KebabHorizontalIcon}/>
</ActionMenu.Anchor>
<ActionMenu.Overlay>
<ActionList>
Expand Down