@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.js
CHANGED
|
@@ -7917,9 +7917,9 @@ function useMenuController(props) {
|
|
|
7917
7917
|
setActiveIndex(currentIndex);
|
|
7918
7918
|
}, [setActiveIndex]);
|
|
7919
7919
|
const handleItemMouseLeave = react.useCallback(() => {
|
|
7920
|
+
setActiveIndex(-2);
|
|
7920
7921
|
rootElement == null ? void 0 : rootElement.focus();
|
|
7921
|
-
|
|
7922
|
-
}, [rootElement, setActiveIndex]);
|
|
7922
|
+
}, [setActiveIndex, rootElement]);
|
|
7923
7923
|
react.useEffect(() => {
|
|
7924
7924
|
if (!mounted) return;
|
|
7925
7925
|
const rafId = window.requestAnimationFrame(() => {
|
|
@@ -9229,7 +9229,7 @@ const TreeItem = react.memo(function TreeItem2(props) {
|
|
|
9229
9229
|
const handleClick = react.useCallback(event => {
|
|
9230
9230
|
if (onClick) onClick(event);
|
|
9231
9231
|
const target = event.target;
|
|
9232
|
-
if (target instanceof HTMLElement && (target.getAttribute("data-ui") === "
|
|
9232
|
+
if (target instanceof HTMLElement && (target.getAttribute("data-ui") === "TreeItem" || target.closest('[data-ui="TreeItem__box"]'))) {
|
|
9233
9233
|
event.stopPropagation();
|
|
9234
9234
|
setExpanded(itemKey, !expanded);
|
|
9235
9235
|
setFocusedElement(rootRef.current);
|