mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-18 11:36:36 +00:00
fix styling and behavior of overflow menu,
when it is opened for the first time
This commit is contained in:
parent
d02fb2bc78
commit
a76f57c608
1 changed files with 6 additions and 10 deletions
|
@ -66,7 +66,7 @@
|
||||||
const currentIndex = writable(-1);
|
const currentIndex = writable(-1);
|
||||||
|
|
||||||
let buttonWidth = undefined;
|
let buttonWidth = undefined;
|
||||||
let didOpen = false;
|
let onMountAfterUpdate = true;
|
||||||
|
|
||||||
setContext("OverflowMenu", {
|
setContext("OverflowMenu", {
|
||||||
focusedId,
|
focusedId,
|
||||||
|
@ -108,7 +108,7 @@
|
||||||
|
|
||||||
buttonWidth = width;
|
buttonWidth = width;
|
||||||
|
|
||||||
if ($currentIndex < 0) {
|
if (!onMountAfterUpdate && $currentIndex < 0) {
|
||||||
menuRef.focus();
|
menuRef.focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -125,15 +125,11 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (didOpen && !open) {
|
items.set([]);
|
||||||
items.set([]);
|
currentId.set(undefined);
|
||||||
currentId.set(undefined);
|
currentIndex.set(0);
|
||||||
currentIndex.set(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!didOpen && open) {
|
onMountAfterUpdate = false;
|
||||||
didOpen = true;
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$: ariaLabel = $$props["aria-label"] || "menu";
|
$: ariaLabel = $$props["aria-label"] || "menu";
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue