@xsolla/xui-context-menu 0.187.0 → 0.187.2

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/web/index.mjs CHANGED
@@ -1607,9 +1607,16 @@ var ContextMenuRoot = forwardRef(
1607
1607
  if (activeElement && panelRef.current.contains(activeElement)) return;
1608
1608
  panelRef.current.focus();
1609
1609
  }, [isOpen, cellsVersion]);
1610
+ const wasOpen = useRef2(isOpen);
1610
1611
  useEffect3(() => {
1611
- if (isOpen) return;
1612
- triggerRef.current?.focus();
1612
+ if (isOpen) {
1613
+ wasOpen.current = true;
1614
+ return;
1615
+ }
1616
+ if (wasOpen.current) {
1617
+ triggerRef.current?.focus();
1618
+ wasOpen.current = false;
1619
+ }
1613
1620
  }, [isOpen]);
1614
1621
  const contextValue = useMemo(
1615
1622
  () => ({