fix styling and behavior of overflow menu,

when it is opened for the first time
This commit is contained in:
ebeuker 2021-01-03 13:49:53 +01:00
commit a76f57c608

View file

@ -66,7 +66,7 @@
const currentIndex = writable(-1);
let buttonWidth = undefined;
let didOpen = false;
let onMountAfterUpdate = true;
setContext("OverflowMenu", {
focusedId,
@ -108,7 +108,7 @@
buttonWidth = width;
if ($currentIndex < 0) {
if (!onMountAfterUpdate && $currentIndex < 0) {
menuRef.focus();
}
@ -125,15 +125,11 @@
}
}
if (didOpen && !open) {
items.set([]);
currentId.set(undefined);
currentIndex.set(0);
}
items.set([]);
currentId.set(undefined);
currentIndex.set(0);
if (!didOpen && open) {
didOpen = true;
}
onMountAfterUpdate = false;
});
$: ariaLabel = $$props["aria-label"] || "menu";