Skip to content

Commit

Permalink
fix(core/burger-menu): a11y expand state (#1112)
Browse files Browse the repository at this point in the history
  • Loading branch information
nuke-ellington committed Feb 23, 2024
1 parent 62b7565 commit cd3d033
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 5 deletions.
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

0 comments on commit cd3d033

Please sign in to comment.