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

fix(core/burger-menu): a11y expand state #1112

Merged
merged 2 commits into from
Feb 23, 2024
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
4 changes: 0 additions & 4 deletions packages/core/src/components/menu/burger-menu.scss
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,4 @@ $focus-bdr-width: 0.0625rem;
transform: rotate(45deg);
y: 11px;
}

ix-icon-button {
transform: rotate(180deg);
}
}
5 changes: 4 additions & 1 deletion packages/core/src/components/menu/burger-menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,10 @@ export class BurgerMenu {
}}
>
{this.pinned ? (
<ix-icon-button icon={'double-chevron-right'} ghost></ix-icon-button>
<ix-icon-button
icon={`double-chevron-${this.expanded ? 'left' : 'right'}`}
ghost
></ix-icon-button>
) : (
<button
class={{
Expand Down
22 changes: 22 additions & 0 deletions packages/core/src/components/menu/test/menu.ct.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,28 @@ test('should close menu by bottom icon click', async ({ mount, page }) => {
await expect(element).toBeVisible();
});

test('should have correct aria label', async ({ mount, page }) => {
await mount(`
<ix-menu pinned>
</ix-menu>
`);

await page.locator('ix-menu');
const chevronButton = page.locator('ix-icon-button button');

await expect(chevronButton).toHaveAttribute(
'aria-label',
'Double Chevron Right'
);

chevronButton.click();

await expect(chevronButton).toHaveAttribute(
'aria-label',
'Double Chevron Left'
);
});

async function clickAboutButton(element: Locator, page: Page) {
const aboutButton = element.locator('ix-menu-item#aboutAndLegal');
await aboutButton.click();
Expand Down
Loading