Handle dynamically adding items in list components: Radio Group, Tabs, Listbox, Menu

Fixes #29

Upstream Headless UI handles this for Radio Group but not for the others. I didn't see any reason why not to implement this for the other ones too.
This commit is contained in:
Ryan Gossiaux
2021-12-31 11:46:00 -10:00
parent b5b6854d2d
commit e16e27f04e
10 changed files with 263 additions and 14 deletions

View File

@@ -27,7 +27,7 @@
return () => $api.unregisterTab(tabRef);
});
$: myIndex = $api.tabs.indexOf(tabRef);
$: myIndex = tabRef ? $api.tabs.indexOf(tabRef) : -1;
$: selected = myIndex === $api.selectedIndex;
function handleKeyDown(e: CustomEvent) {