mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-15 10:21:05 +00:00
Overflow menu first time open behavior is not correct (#477)
* Close overflow menu on focusout * fix styling and behavior of overflow menu, when it is opened for the first time * remove previous commit * Fix keyboard navigation of overflow menu items
This commit is contained in:
parent
28349561ac
commit
775ceb47c1
1 changed files with 4 additions and 6 deletions
|
@ -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,13 @@
|
|||
}
|
||||
}
|
||||
|
||||
if (didOpen && !open) {
|
||||
if (!open) {
|
||||
items.set([]);
|
||||
currentId.set(undefined);
|
||||
currentIndex.set(0);
|
||||
}
|
||||
|
||||
if (!didOpen && open) {
|
||||
didOpen = true;
|
||||
}
|
||||
onMountAfterUpdate = false;
|
||||
});
|
||||
|
||||
$: ariaLabel = $$props["aria-label"] || "menu";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue