@sanity/ui 1.7.1 → 1.7.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.esm.js +3 -3
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/menu/__workshop__/index.ts +5 -0
- package/src/components/menu/__workshop__/shouldFocus.tsx +46 -0
- package/src/components/menu/useMenuController.ts +7 -2
- package/src/components/tree/treeItem.tsx +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -7904,9 +7904,9 @@ function useMenuController(props) {
|
|
|
7904
7904
|
setActiveIndex(currentIndex);
|
|
7905
7905
|
}, [setActiveIndex]);
|
|
7906
7906
|
const handleItemMouseLeave = useCallback(() => {
|
|
7907
|
+
setActiveIndex(-2);
|
|
7907
7908
|
rootElement == null ? void 0 : rootElement.focus();
|
|
7908
|
-
|
|
7909
|
-
}, [rootElement, setActiveIndex]);
|
|
7909
|
+
}, [setActiveIndex, rootElement]);
|
|
7910
7910
|
useEffect(() => {
|
|
7911
7911
|
if (!mounted) return;
|
|
7912
7912
|
const rafId = window.requestAnimationFrame(() => {
|
|
@@ -9216,7 +9216,7 @@ const TreeItem = memo(function TreeItem2(props) {
|
|
|
9216
9216
|
const handleClick = useCallback(event => {
|
|
9217
9217
|
if (onClick) onClick(event);
|
|
9218
9218
|
const target = event.target;
|
|
9219
|
-
if (target instanceof HTMLElement && (target.getAttribute("data-ui") === "
|
|
9219
|
+
if (target instanceof HTMLElement && (target.getAttribute("data-ui") === "TreeItem" || target.closest('[data-ui="TreeItem__box"]'))) {
|
|
9220
9220
|
event.stopPropagation();
|
|
9221
9221
|
setExpanded(itemKey, !expanded);
|
|
9222
9222
|
setFocusedElement(rootRef.current);
|