mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-15 10:21:05 +00:00
fix(overflow-menu): add aria-controls
to trigger button
This commit is contained in:
parent
7256a7987c
commit
c5511fcf90
1 changed files with 3 additions and 0 deletions
|
@ -162,6 +162,7 @@
|
||||||
onMountAfterUpdate = false;
|
onMountAfterUpdate = false;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$: menuId = `menu-${id}`;
|
||||||
$: ariaLabel = $$props["aria-label"] || "menu";
|
$: ariaLabel = $$props["aria-label"] || "menu";
|
||||||
$: if ($items[$currentIndex]) {
|
$: if ($items[$currentIndex]) {
|
||||||
focusedId.set($items[$currentIndex].id);
|
focusedId.set($items[$currentIndex].id);
|
||||||
|
@ -194,6 +195,7 @@
|
||||||
aria-haspopup="true"
|
aria-haspopup="true"
|
||||||
aria-expanded={open}
|
aria-expanded={open}
|
||||||
aria-label={ariaLabel}
|
aria-label={ariaLabel}
|
||||||
|
aria-controls={open ? menuId : undefined}
|
||||||
{id}
|
{id}
|
||||||
class:bx--overflow-menu={true}
|
class:bx--overflow-menu={true}
|
||||||
class:bx--overflow-menu--open={open}
|
class:bx--overflow-menu--open={open}
|
||||||
|
@ -239,6 +241,7 @@
|
||||||
bind:this={menuRef}
|
bind:this={menuRef}
|
||||||
role="menu"
|
role="menu"
|
||||||
tabindex="-1"
|
tabindex="-1"
|
||||||
|
id={menuId}
|
||||||
aria-label={ariaLabel}
|
aria-label={ariaLabel}
|
||||||
data-floating-menu-direction={direction}
|
data-floating-menu-direction={direction}
|
||||||
class:bx--overflow-menu-options={true}
|
class:bx--overflow-menu-options={true}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue