@melt-ui/svelte
Advanced tools
Comparing version 0.18.2 to 0.18.3
@@ -6,3 +6,3 @@ /// <reference types="svelte" /> | ||
'data-state': string; | ||
'data-disabled': string | boolean; | ||
'data-disabled': string; | ||
}, string>; | ||
@@ -13,7 +13,8 @@ trigger: import("../../internal/helpers").BuilderReturn<[import("svelte/store").Writable<boolean>, import("svelte/store").Writable<boolean>], (node: HTMLElement) => { | ||
'data-state': string; | ||
'data-disabled': boolean | undefined; | ||
'data-disabled': string | undefined; | ||
disabled: string | undefined; | ||
}, string>; | ||
content: import("../../internal/helpers").BuilderReturn<[import("svelte/store").Writable<boolean>, import("svelte/store").Writable<boolean>], import("svelte/action").Action<any, any, Record<never, any>>, ([$open, $disabled]: [boolean, boolean]) => { | ||
'data-state': string; | ||
'data-disabled': boolean | undefined; | ||
'data-disabled': string | undefined; | ||
hidden: boolean | undefined; | ||
@@ -20,0 +21,0 @@ }, string>; |
@@ -16,3 +16,3 @@ import { addEventListener, builder, createElHelpers } from '../../internal/helpers'; | ||
'data-state': $open ? 'open' : 'closed', | ||
'data-disabled': options.disabled ? true : 'undefined', | ||
'data-disabled': options.disabled ? '' : 'undefined', | ||
}), | ||
@@ -24,6 +24,10 @@ }); | ||
'data-state': $open ? 'open' : 'closed', | ||
'data-disabled': $disabled ? true : undefined, | ||
'data-disabled': $disabled ? '' : undefined, | ||
disabled: $disabled ? '' : undefined, | ||
}), | ||
action: (node) => { | ||
const unsub = addEventListener(node, 'click', () => { | ||
const disabled = node.dataset.disabled !== undefined; | ||
if (disabled) | ||
return; | ||
open.update(($open) => !$open); | ||
@@ -40,3 +44,3 @@ }); | ||
'data-state': $open ? 'open' : 'closed', | ||
'data-disabled': $disabled ? true : undefined, | ||
'data-disabled': $disabled ? '' : undefined, | ||
hidden: $open ? undefined : true, | ||
@@ -43,0 +47,0 @@ }), |
@@ -107,3 +107,3 @@ import { usePopper } from '../../internal/actions/popper'; | ||
*/ | ||
const isKeyDownInside = target.closest(selector()) === menuElement; | ||
const isKeyDownInside = target.closest('[role="menu"]') === menuElement; | ||
if (!isKeyDownInside) | ||
@@ -582,2 +582,5 @@ return; | ||
e.preventDefault(); | ||
rootActiveTrigger.set(null); | ||
rootOpen.set(false); | ||
handleTabNavigation(e, nextFocusable, prevFocusable); | ||
return; | ||
@@ -1038,3 +1041,4 @@ } | ||
export function getMenuItems(menuElement) { | ||
return Array.from(menuElement.querySelectorAll(`[data-melt-menu-id="${menuElement.id}"]`)); | ||
const menuItems = Array.from(menuElement.querySelectorAll(`[data-melt-menu-id="${menuElement.id}"]`)); | ||
return menuItems; | ||
} | ||
@@ -1041,0 +1045,0 @@ export function applyAttrsIfDisabled(element) { |
@@ -108,3 +108,3 @@ import { get, writable } from 'svelte/store'; | ||
*/ | ||
const isKeyDownInside = target.closest('[data-melt-menubar-menu]') === menuElement; | ||
const isKeyDownInside = target.closest('[role="menu"]') === menuElement; | ||
if (!isKeyDownInside) | ||
@@ -111,0 +111,0 @@ return; |
@@ -29,3 +29,4 @@ import { get, writable } from 'svelte/store'; | ||
const candidateItems = items.filter((item) => { | ||
if (item.hasAttribute('disabled')) { | ||
if (item.getAttribute('disabled') === 'true' || | ||
item.getAttribute('aria-disabled') === 'true') { | ||
return false; | ||
@@ -32,0 +33,0 @@ } |
{ | ||
"name": "@melt-ui/svelte", | ||
"version": "0.18.2", | ||
"version": "0.18.3", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "exports": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
389282
9604