@kaizen/components 1.42.3 → 1.42.4

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.
@@ -1,6 +1,7 @@
1
1
  import { __assign } from 'tslib';
2
2
  import React, { useState, useCallback, useEffect } from 'react';
3
3
  import classnames from 'classnames';
4
+ import { FocusOn } from 'react-focus-on';
4
5
  import { usePopper } from 'react-popper';
5
6
  import styles from './MenuDropdown.module.scss.mjs';
6
7
  const MenuDropdown = /*#__PURE__*/function () {
@@ -66,20 +67,20 @@ const MenuDropdown = /*#__PURE__*/function () {
66
67
  }
67
68
  };
68
69
  }, [autoHide, handleDocumentClickForAutoHide]);
69
- return (
70
- /*#__PURE__*/
71
- // Disabling these because we don't want this to be keyboard focusable.
72
- // Esc keypress should be used instead for the same behaviour (hasn't been implemented here yet)
73
- // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
74
- React.createElement("div", __assign({
75
- id: id,
76
- ref: setPopperElement
77
- }, attributes.popper, {
78
- style: popperStyles.popper,
79
- className: classnames(styles.menuContainer, width == "default" && styles.defaultWidth),
80
- onClick: handleRootClick
81
- }), children)
82
- );
70
+ return /*#__PURE__*/React.createElement(FocusOn, {
71
+ enabled: !!referenceElement,
72
+ scrollLock: false,
73
+ noIsolation: true,
74
+ shards: referenceElement ? [referenceElement] : undefined,
75
+ onEscapeKey: hideMenuDropdown
76
+ }, /*#__PURE__*/React.createElement("div", __assign({
77
+ id: id,
78
+ ref: setPopperElement
79
+ }, attributes.popper, {
80
+ style: popperStyles.popper,
81
+ className: classnames(styles.menuContainer, width == "default" && styles.defaultWidth),
82
+ onClick: handleRootClick
83
+ }), children));
83
84
  };
84
85
  MenuDropdown.displayName = "MenuDropdown";
85
86
  return MenuDropdown;