@eqtylab/equality 4.3.0 → 4.3.1

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.js CHANGED
@@ -1964,11 +1964,16 @@ var DropdownMenuSub = ({
1964
1964
  return /* @__PURE__ */ jsx(DropdownMenuPrimitive.Sub, { ...props, children });
1965
1965
  };
1966
1966
  var MENU_ITEM_SELECTOR = '[role="menuitem"]:not([data-disabled]),[role="menuitemcheckbox"]:not([data-disabled]),[role="menuitemradio"]:not([data-disabled])';
1967
- var DropdownMenuContent = React15.forwardRef(({ className, sideOffset = 4, onKeyDown, children, ...props }, ref) => {
1967
+ var DropdownMenuContent = React15.forwardRef(({ className, sideOffset = 4, onKeyDown, onFocus, children, ...props }, ref) => {
1968
1968
  const ctx = useDropdownMenuSearch();
1969
1969
  const setListId = ctx?.setListId;
1970
1970
  const searching = isSearchActive(ctx);
1971
1971
  const resultCount = ctx?.matchCount ?? 0;
1972
+ const openFocusHandledRef = React15.useRef(false);
1973
+ const searchVisible = ctx?.visible ?? false;
1974
+ React15.useEffect(() => {
1975
+ if (!searchVisible) openFocusHandledRef.current = false;
1976
+ }, [searchVisible]);
1972
1977
  const composedContentRef = React15.useCallback(
1973
1978
  (node) => {
1974
1979
  assignRefs(node, ref);
@@ -1982,6 +1987,13 @@ var DropdownMenuContent = React15.forwardRef(({ className, sideOffset = 4, onKey
1982
1987
  ref: composedContentRef,
1983
1988
  sideOffset,
1984
1989
  className: cn(styles22["dropdown-menu-content"], className),
1990
+ onFocus: (event) => {
1991
+ onFocus?.(event);
1992
+ if (openFocusHandledRef.current) return;
1993
+ openFocusHandledRef.current = true;
1994
+ if (event.target !== event.currentTarget || !ctx?.enabled || !ctx.visible) return;
1995
+ ctx.requestFocus();
1996
+ },
1985
1997
  onKeyDown: (event) => {
1986
1998
  onKeyDown?.(event);
1987
1999
  if (!ctx?.enabled) return;