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

Toolbar: Icon only buttons do not have aria-labels #2677

Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ describe('modus-toolbar', () => {
expect(root).toEqualHtml(`
<modus-toolbar role="toolbar">
<mock:shadow-root>
<modus-button button-style="borderless" class="modus-button" color="secondary">
<modus-button arialabel="button" button-style="borderless" class="modus-button" color="secondary">
Button
</modus-button>
</mock:shadow-root>
Expand Down Expand Up @@ -52,7 +52,7 @@ describe('modus-toolbar', () => {
expect(root).toEqualHtml(`
<modus-toolbar role="toolbar">
<mock:shadow-root>
<modus-button button-style="borderless" class="modus-button" color="secondary" icon-only="close">
<modus-button arialabel="button" button-style="borderless" class="modus-button" color="secondary" icon-only="close">
Button
</modus-button>
</mock:shadow-root>
Expand All @@ -73,7 +73,7 @@ describe('modus-toolbar', () => {
expect(root).toEqualHtml(`
<modus-toolbar role="toolbar">
<mock:shadow-root>
<modus-button button-style="borderless" class="modus-button" color="secondary" icon-only="close">
<modus-button arialabel="button" button-style="borderless" class="modus-button" color="secondary" icon-only="close">
Button
</modus-button>
</mock:shadow-root>
Expand All @@ -94,7 +94,7 @@ describe('modus-toolbar', () => {
expect(root).toEqualHtml(`
<modus-toolbar role="toolbar">
<mock:shadow-root>
<modus-button button-style="borderless" class="modus-button" color="secondary">
<modus-button arialabel="button" button-style="borderless" class="modus-button" color="secondary">
Button
</modus-button>
</mock:shadow-root>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,12 @@ export class ModusToolbar {
createButton(child: Element) {
const className = 'modus-button';
const iconOnly = child.getAttribute('icon-only');
const ariaLabel = child.getAttribute('aria-label') || 'button';
const label = child.textContent ? child.textContent.trim() : '';

return (
<modus-button
ariaLabel={ariaLabel}
button-style="borderless"
color="secondary"
class={className}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,4 @@ The `modus-toolbar` component provides a customizable Toolbar that can be positi

- Toolbar gets role="toolbar"
- Toolbar gets an `aria-label` provided by the `aria-label` property input.
- Toolbar button gets an `aria-label` provided by the `aria-label` property input.