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}) => (
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we rely on the spread ({...args} line 32) to pass the overflowLabel to the story? This way we don't need to create the object entirely.

Let me know if that makes sense, or if you have questions!

Suggested change
render: ({'aria-labelledby': _, overflowLabel, ...args}) => (
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 @@
* @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 @@
flush = false,
className,
gap = 'condensed',
overflowLabel

Check failure on line 306 in packages/react/src/ActionBar/ActionBar.tsx

View workflow job for this annotation

GitHub Actions / lint

Insert `,`
} = 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 @@
{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}/>

Check failure on line 410 in packages/react/src/ActionBar/ActionBar.tsx

View workflow job for this annotation

GitHub Actions / lint

Replace `'invisible'·aria-label={overflowLabel·??·"More·items"}·icon={KebabHorizontalIcon}` with `"invisible"·aria-label={overflowLabel·??·'More·items'}·icon={KebabHorizontalIcon}·`
</ActionMenu.Anchor>
<ActionMenu.Overlay>
<ActionList>
Expand Down
Loading