Misc fixes to Menus

* Disabled prop not forwarded correctly to MenuButton
* Active element not set correctly when Menu is opened
* Log message had wrong component name
This commit is contained in:
Ryan Gossiaux
2021-12-27 21:58:34 -10:00
parent 6af4b2a3b6
commit fe0388cc44
3 changed files with 2 additions and 2 deletions

View File

@@ -78,6 +78,7 @@
$: propsWeControl = {
id,
type: resolveButtonType({ type: $$props.type, as }, $buttonStore),
disabled: disabled ? true : undefined,
"aria-haspopup": true,
"aria-controls": $itemsStore?.id,
"aria-expanded": disabled ? undefined : $api.menuState === MenuStates.Open,

View File

@@ -27,7 +27,6 @@
$: data = { disabled, textValue } as MenuItemData;
onMount(async () => {
await tick();
$api.registerItem(id, data);
});

View File

@@ -15,7 +15,7 @@
const forwardEvents = forwardEventsBuilder(get_current_component());
export let as: SupportedAs = "div";
export let use: HTMLActionArray = [];
const api = useMenuContext("MenuButton");
const api = useMenuContext("MenuItems");
const id = `headlessui-menu-items-${useId()}`;
let searchDebounce: ReturnType<typeof setTimeout> | null = null;