Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add aria-label to icon only menu button stories #1541

Merged
merged 4 commits into from
Sep 23, 2024
Merged
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
11 changes: 8 additions & 3 deletions packages/components/menu/src/menu-button.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ type Props = Pick<MenuButton, 'disabled' | 'fill' | 'position' | 'size' | 'varia
alignSelf: string;
body: string | TemplateResult;
justifySelf: string;
label?: string;
menuItems?(): TemplateResult;
};
type Story = StoryObj<Props>;
Expand Down Expand Up @@ -86,7 +87,7 @@ export default {
// Disables Chromatic's snapshotting on a story level
chromatic: { disableSnapshot: true }
},
render: ({ alignSelf, body, disabled, fill, justifySelf, menuItems, position, size, variant }) => {
render: ({ alignSelf, body, disabled, fill, justifySelf, label, menuItems, position, size, variant }) => {
return html`
<style>
#root-inner {
Expand All @@ -97,6 +98,7 @@ export default {
</style>
<sl-menu-button
?disabled=${disabled}
aria-label=${ifDefined(label)}
fill=${ifDefined(fill)}
position=${ifDefined(position)}
size=${ifDefined(size)}
Expand All @@ -112,6 +114,7 @@ export default {
export const Basic: Story = {
args: {
body: html`<sl-icon name="far-gear" slot="button"></sl-icon>`,
label: 'Label',
menuItems: () => html`
<sl-menu-item>
<sl-icon name="far-pen"></sl-icon>
Expand All @@ -138,14 +141,16 @@ export const IconAndText: Story = {
body: html`
<sl-icon name="far-gear" slot="button"></sl-icon>
<span slot="button">Settings</span>
`
`,
label: undefined
}
};

export const Text: Story = {
args: {
...Basic.args,
body: html`<span slot="button">Settings</span>`
body: html`<span slot="button">Settings</span>`,
label: undefined
}
};

Expand Down