@wix/editor-react-components 1.2554.0 → 1.2556.0

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.
@@ -864,6 +864,7 @@ const MenuItemLabel = (props) => {
864
864
  const { label: label2, link } = item2;
865
865
  const hasLink = !isEmptyObject(link);
866
866
  const linkRef = useRef(null);
867
+ const srOnlyChevronButtonRef = useRef(null);
867
868
  const itemLabelClassName = (_d = (_c = (_b = (_a = props.menuElementProps) == null ? void 0 : _a.item) == null ? void 0 : _b.elementProps) == null ? void 0 : _c.itemLabel) == null ? void 0 : _d.className;
868
869
  const labelContainerClassNames = clsx(
869
870
  selectors.item,
@@ -937,7 +938,7 @@ const MenuItemLabel = (props) => {
937
938
  "<%= itemName %>",
938
939
  label2
939
940
  ),
940
- chevronButtonRef,
941
+ chevronButtonRef: variant === "srOnly" ? srOnlyChevronButtonRef : chevronButtonRef,
941
942
  onClick: toggleDropdown,
942
943
  isOpen,
943
944
  hasSubItems,
@@ -1697,10 +1698,12 @@ const MenuItem = (props) => {
1697
1698
  prevHamburgerOpenRef.current = isHamburgerMenuOpened;
1698
1699
  }, [isHamburgerMenuOpened, isOpen, hideDropdown]);
1699
1700
  const handleEscKeyDown = useCallback(() => {
1700
- var _a2;
1701
- (_a2 = chevronButtonRef.current) == null ? void 0 : _a2.focus();
1701
+ var _a2, _b2;
1702
+ if ((_a2 = itemRef.current) == null ? void 0 : _a2.contains(document.activeElement)) {
1703
+ (_b2 = chevronButtonRef.current) == null ? void 0 : _b2.focus();
1704
+ }
1702
1705
  hideDropdown();
1703
- }, [hideDropdown, chevronButtonRef]);
1706
+ }, [hideDropdown]);
1704
1707
  const handleKeyDown = useCallback(
1705
1708
  (event) => {
1706
1709
  if (event.key === "Escape") {
@@ -1,4 +1,4 @@
1
- import { default as React } from 'react';
1
+ import { RefObject, default as React } from 'react';
2
2
  import { IMenuItemProps } from '../../../Menu.types';
3
3
  import { DropdownAnimationNameType } from '../../../constants';
4
4
  import { AnimationState } from './useAnimationState';
@@ -6,7 +6,7 @@ export declare const MenuItemLabel: React.FC<IMenuItemProps & {
6
6
  hasDropdownMenu: boolean;
7
7
  hasSubItems: boolean;
8
8
  hasContainer: boolean;
9
- chevronButtonRef: any;
9
+ chevronButtonRef: RefObject<HTMLButtonElement>;
10
10
  toggleDropdown: () => void;
11
11
  isOpen: boolean;
12
12
  dropdownAnimationState: AnimationState<DropdownAnimationNameType>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/editor-react-components",
3
- "version": "1.2554.0",
3
+ "version": "1.2556.0",
4
4
  "description": "React components for the Wix Editor",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -84,7 +84,7 @@
84
84
  "@wix/site-service-business-logger": "^1.0.0",
85
85
  "@wix/site-service-configuration": "^1.0.1",
86
86
  "@wix/site-service-rendering-context": "^1.0.1",
87
- "@wix/site-ui": "1.236.0",
87
+ "@wix/site-ui": "1.237.0",
88
88
  "@wix/video": "^1.106.0",
89
89
  "@wix/viewer-service-consent-policy": "^1.0.101",
90
90
  "@wix/web-bi-logger": "^2.1.29",
@@ -199,5 +199,5 @@
199
199
  "registry": "https://registry.npmjs.org/",
200
200
  "access": "public"
201
201
  },
202
- "falconPackageHash": "2af7f2f83c58579501655ff433c12481f07767e2d31d48d35e09f638"
202
+ "falconPackageHash": "e94bace123d34f1b183027de42358d46d5a9236772e479d9d259096c"
203
203
  }