@atlaskit/dropdown-menu 16.2.0 → 16.3.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,27 @@
1
1
  # @atlaskit/dropdown-menu
2
2
 
3
+ ## 16.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#187451](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/187451)
8
+ [`c40feaf938dc1`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/c40feaf938dc1) -
9
+ This cleans up the feature flag references for focus improvements when interactive elements are
10
+ clicked outside of the menu, making them fully available to all people.
11
+
12
+ ### Patch Changes
13
+
14
+ - Updated dependencies
15
+
16
+ ## 16.2.1
17
+
18
+ ### Patch Changes
19
+
20
+ - [#188621](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/188621)
21
+ [`94981059e9ba8`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/94981059e9ba8) -
22
+ Added accessible label for MenuGroup in DropdownMenu
23
+ - Updated dependencies
24
+
3
25
  ## 16.2.0
4
26
 
5
27
  ### Minor Changes
@@ -19,7 +19,6 @@ var _noop = _interopRequireDefault(require("@atlaskit/ds-lib/noop"));
19
19
  var _useControlled = _interopRequireDefault(require("@atlaskit/ds-lib/use-controlled"));
20
20
  var _useFocusEvent = _interopRequireDefault(require("@atlaskit/ds-lib/use-focus-event"));
21
21
  var _chevronDown = _interopRequireDefault(require("@atlaskit/icon/core/migration/chevron-down"));
22
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
23
22
  var _popup = _interopRequireDefault(require("@atlaskit/popup"));
24
23
  var _constants = require("@atlaskit/theme/constants");
25
24
  var _focusManager = _interopRequireDefault(require("./internal/components/focus-manager"));
@@ -101,7 +100,8 @@ var DropdownMenu = function DropdownMenu(_ref) {
101
100
  zIndex = _ref$zIndex === void 0 ? _constants.layers.modal() : _ref$zIndex,
102
101
  label = _ref.label,
103
102
  interactionName = _ref.interactionName,
104
- strategy = _ref.strategy;
103
+ strategy = _ref.strategy,
104
+ menuLabel = _ref.menuLabel;
105
105
  var _useControlledState = (0, _useControlled.default)(isOpen, function () {
106
106
  return defaultOpen;
107
107
  }),
@@ -187,9 +187,7 @@ var DropdownMenu = function DropdownMenu(_ref) {
187
187
  var _event$target$closest2, _event$target2;
188
188
  // Don't focus the trigger if the click was outside of the menu
189
189
  var isClickOutsideMenu = (event === null || event === void 0 ? void 0 : event.target) instanceof HTMLElement && ((_event$target$closest2 = (_event$target2 = event.target).closest) === null || _event$target$closest2 === void 0 ? void 0 : _event$target$closest2.call(_event$target2, '[role="menu"]')) === null;
190
- var shouldPreventFocus = isClickOutsideMenu && document.activeElement !== document.body &&
191
- // except if clicking on the body
192
- (0, _platformFeatureFlags.fg)('platform_design_system_team_dropdown_return_focus');
190
+ var shouldPreventFocus = isClickOutsideMenu && document.activeElement !== document.body; // except if clicking on the body
193
191
  if (!shouldPreventFocus) {
194
192
  requestAnimationFrame(function () {
195
193
  var _triggerRef$current;
@@ -331,7 +329,8 @@ var DropdownMenu = function DropdownMenu(_ref) {
331
329
  shouldRenderToParent: shouldRenderToParent || shouldFitContainer,
332
330
  isTriggeredUsingKeyboard: isTriggeredUsingKeyboard,
333
331
  autoFocus: autoFocus,
334
- testId: testId && "".concat(testId, "--menu-wrapper")
332
+ testId: testId && "".concat(testId, "--menu-wrapper"),
333
+ menuLabel: menuLabel
335
334
  }, children));
336
335
  }
337
336
  })));
@@ -54,7 +54,8 @@ var MenuWrapper = function MenuWrapper(_ref2) {
54
54
  spacing = _ref2.spacing,
55
55
  testId = _ref2.testId,
56
56
  isTriggeredUsingKeyboard = _ref2.isTriggeredUsingKeyboard,
57
- autoFocus = _ref2.autoFocus;
57
+ autoFocus = _ref2.autoFocus,
58
+ menuLabel = _ref2.menuLabel;
58
59
  var _useContext = (0, _react.useContext)(_focusManager.FocusManagerContext),
59
60
  menuItemRefs = _useContext.menuItemRefs;
60
61
  var closeOnMenuItemClick = function closeOnMenuItemClick(e) {
@@ -102,7 +103,8 @@ var MenuWrapper = function MenuWrapper(_ref2) {
102
103
  onClick: closeOnMenuItemClick,
103
104
  role: "menu",
104
105
  spacing: spacing,
105
- testId: testId && "".concat(testId, "--menu-group")
106
+ testId: testId && "".concat(testId, "--menu-group"),
107
+ menuLabel: menuLabel
106
108
  }, isLoading ? /*#__PURE__*/React.createElement(LoadingIndicator, {
107
109
  statusLabel: statusLabel,
108
110
  testId: testId && "".concat(testId, "--loading-indicator")
@@ -8,7 +8,6 @@ import noop from '@atlaskit/ds-lib/noop';
8
8
  import useControlledState from '@atlaskit/ds-lib/use-controlled';
9
9
  import useFocus from '@atlaskit/ds-lib/use-focus-event';
10
10
  import ExpandIcon from '@atlaskit/icon/core/migration/chevron-down';
11
- import { fg } from '@atlaskit/platform-feature-flags';
12
11
  import Popup from '@atlaskit/popup';
13
12
  // eslint-disable-next-line @atlaskit/design-system/no-deprecated-imports
14
13
  import { gridSize as gridSizeFn, layers } from '@atlaskit/theme/constants';
@@ -78,7 +77,8 @@ const DropdownMenu = ({
78
77
  zIndex = layers.modal(),
79
78
  label,
80
79
  interactionName,
81
- strategy
80
+ strategy,
81
+ menuLabel
82
82
  }) => {
83
83
  const [isLocalOpen, setLocalIsOpen] = useControlledState(isOpen, () => defaultOpen);
84
84
  const triggerRef = useRef(null);
@@ -157,9 +157,7 @@ const DropdownMenu = ({
157
157
  var _event$target$closest2, _event$target2;
158
158
  // Don't focus the trigger if the click was outside of the menu
159
159
  const isClickOutsideMenu = (event === null || event === void 0 ? void 0 : event.target) instanceof HTMLElement && ((_event$target$closest2 = (_event$target2 = event.target).closest) === null || _event$target$closest2 === void 0 ? void 0 : _event$target$closest2.call(_event$target2, '[role="menu"]')) === null;
160
- const shouldPreventFocus = isClickOutsideMenu && document.activeElement !== document.body &&
161
- // except if clicking on the body
162
- fg('platform_design_system_team_dropdown_return_focus');
160
+ const shouldPreventFocus = isClickOutsideMenu && document.activeElement !== document.body; // except if clicking on the body
163
161
  if (!shouldPreventFocus) {
164
162
  requestAnimationFrame(() => {
165
163
  var _triggerRef$current;
@@ -303,7 +301,8 @@ const DropdownMenu = ({
303
301
  shouldRenderToParent: shouldRenderToParent || shouldFitContainer,
304
302
  isTriggeredUsingKeyboard: isTriggeredUsingKeyboard,
305
303
  autoFocus: autoFocus,
306
- testId: testId && `${testId}--menu-wrapper`
304
+ testId: testId && `${testId}--menu-wrapper`,
305
+ menuLabel: menuLabel
307
306
  }, children))
308
307
  })));
309
308
  };
@@ -43,7 +43,8 @@ const MenuWrapper = ({
43
43
  spacing,
44
44
  testId,
45
45
  isTriggeredUsingKeyboard,
46
- autoFocus
46
+ autoFocus,
47
+ menuLabel
47
48
  }) => {
48
49
  const {
49
50
  menuItemRefs
@@ -92,7 +93,8 @@ const MenuWrapper = ({
92
93
  onClick: closeOnMenuItemClick,
93
94
  role: "menu",
94
95
  spacing: spacing,
95
- testId: testId && `${testId}--menu-group`
96
+ testId: testId && `${testId}--menu-group`,
97
+ menuLabel: menuLabel
96
98
  }, isLoading ? /*#__PURE__*/React.createElement(LoadingIndicator, {
97
99
  statusLabel: statusLabel,
98
100
  testId: testId && `${testId}--loading-indicator`
@@ -14,7 +14,6 @@ import noop from '@atlaskit/ds-lib/noop';
14
14
  import useControlledState from '@atlaskit/ds-lib/use-controlled';
15
15
  import useFocus from '@atlaskit/ds-lib/use-focus-event';
16
16
  import ExpandIcon from '@atlaskit/icon/core/migration/chevron-down';
17
- import { fg } from '@atlaskit/platform-feature-flags';
18
17
  import Popup from '@atlaskit/popup';
19
18
  // eslint-disable-next-line @atlaskit/design-system/no-deprecated-imports
20
19
  import { gridSize as gridSizeFn, layers } from '@atlaskit/theme/constants';
@@ -93,7 +92,8 @@ var DropdownMenu = function DropdownMenu(_ref) {
93
92
  zIndex = _ref$zIndex === void 0 ? layers.modal() : _ref$zIndex,
94
93
  label = _ref.label,
95
94
  interactionName = _ref.interactionName,
96
- strategy = _ref.strategy;
95
+ strategy = _ref.strategy,
96
+ menuLabel = _ref.menuLabel;
97
97
  var _useControlledState = useControlledState(isOpen, function () {
98
98
  return defaultOpen;
99
99
  }),
@@ -179,9 +179,7 @@ var DropdownMenu = function DropdownMenu(_ref) {
179
179
  var _event$target$closest2, _event$target2;
180
180
  // Don't focus the trigger if the click was outside of the menu
181
181
  var isClickOutsideMenu = (event === null || event === void 0 ? void 0 : event.target) instanceof HTMLElement && ((_event$target$closest2 = (_event$target2 = event.target).closest) === null || _event$target$closest2 === void 0 ? void 0 : _event$target$closest2.call(_event$target2, '[role="menu"]')) === null;
182
- var shouldPreventFocus = isClickOutsideMenu && document.activeElement !== document.body &&
183
- // except if clicking on the body
184
- fg('platform_design_system_team_dropdown_return_focus');
182
+ var shouldPreventFocus = isClickOutsideMenu && document.activeElement !== document.body; // except if clicking on the body
185
183
  if (!shouldPreventFocus) {
186
184
  requestAnimationFrame(function () {
187
185
  var _triggerRef$current;
@@ -323,7 +321,8 @@ var DropdownMenu = function DropdownMenu(_ref) {
323
321
  shouldRenderToParent: shouldRenderToParent || shouldFitContainer,
324
322
  isTriggeredUsingKeyboard: isTriggeredUsingKeyboard,
325
323
  autoFocus: autoFocus,
326
- testId: testId && "".concat(testId, "--menu-wrapper")
324
+ testId: testId && "".concat(testId, "--menu-wrapper"),
325
+ menuLabel: menuLabel
327
326
  }, children));
328
327
  }
329
328
  })));
@@ -45,7 +45,8 @@ var MenuWrapper = function MenuWrapper(_ref2) {
45
45
  spacing = _ref2.spacing,
46
46
  testId = _ref2.testId,
47
47
  isTriggeredUsingKeyboard = _ref2.isTriggeredUsingKeyboard,
48
- autoFocus = _ref2.autoFocus;
48
+ autoFocus = _ref2.autoFocus,
49
+ menuLabel = _ref2.menuLabel;
49
50
  var _useContext = useContext(FocusManagerContext),
50
51
  menuItemRefs = _useContext.menuItemRefs;
51
52
  var closeOnMenuItemClick = function closeOnMenuItemClick(e) {
@@ -93,7 +94,8 @@ var MenuWrapper = function MenuWrapper(_ref2) {
93
94
  onClick: closeOnMenuItemClick,
94
95
  role: "menu",
95
96
  spacing: spacing,
96
- testId: testId && "".concat(testId, "--menu-group")
97
+ testId: testId && "".concat(testId, "--menu-group"),
98
+ menuLabel: menuLabel
97
99
  }, isLoading ? /*#__PURE__*/React.createElement(LoadingIndicator, {
98
100
  statusLabel: statusLabel,
99
101
  testId: testId && "".concat(testId, "--loading-indicator")
@@ -9,5 +9,5 @@ import type { DropdownMenuProps } from './types';
9
9
  * - [Code](https://atlassian.design/components/dropdown-menu/code)
10
10
  * - [Usage](https://atlassian.design/components/dropdown-menu/usage)
11
11
  */
12
- declare const DropdownMenu: <T extends HTMLElement = any>({ autoFocus, children, defaultOpen, isLoading, isOpen, onOpenChange, placement, shouldFitContainer, shouldFlip, shouldRenderToParent, returnFocusRef, spacing, statusLabel, testId, trigger, zIndex, label, interactionName, strategy, }: DropdownMenuProps<T>) => React.JSX.Element;
12
+ declare const DropdownMenu: <T extends HTMLElement = any>({ autoFocus, children, defaultOpen, isLoading, isOpen, onOpenChange, placement, shouldFitContainer, shouldFlip, shouldRenderToParent, returnFocusRef, spacing, statusLabel, testId, trigger, zIndex, label, interactionName, strategy, menuLabel, }: DropdownMenuProps<T>) => React.JSX.Element;
13
13
  export default DropdownMenu;
@@ -7,5 +7,5 @@ import { type MenuWrapperProps } from '../../types';
7
7
  * if a CheckboxItem or RadioItem is clicked.
8
8
  * It also sets focus to the first menu item when opened.
9
9
  */
10
- declare const MenuWrapper: ({ children, isLoading, maxHeight, maxWidth, onClose, onUpdate, statusLabel, setInitialFocusRef, shouldRenderToParent, spacing, testId, isTriggeredUsingKeyboard, autoFocus, }: MenuWrapperProps) => JSX.Element;
10
+ declare const MenuWrapper: ({ children, isLoading, maxHeight, maxWidth, onClose, onUpdate, statusLabel, setInitialFocusRef, shouldRenderToParent, spacing, testId, isTriggeredUsingKeyboard, autoFocus, menuLabel, }: MenuWrapperProps) => JSX.Element;
11
11
  export default MenuWrapper;
@@ -181,6 +181,10 @@ interface InternalDropdownMenuProps<TriggerElement extends HTMLElement = any> {
181
181
  * The default is `fixed`.
182
182
  */
183
183
  strategy?: 'absolute' | 'fixed';
184
+ /**
185
+ * Provide an accessible label for the menu element for assistive technology.
186
+ */
187
+ menuLabel?: string;
184
188
  }
185
189
  type StandardDropdownMenuProps<TriggerElement extends HTMLElement = any> = InternalDropdownMenuProps<TriggerElement> & {
186
190
  shouldFitContainer?: false;
@@ -9,5 +9,5 @@ import type { DropdownMenuProps } from './types';
9
9
  * - [Code](https://atlassian.design/components/dropdown-menu/code)
10
10
  * - [Usage](https://atlassian.design/components/dropdown-menu/usage)
11
11
  */
12
- declare const DropdownMenu: <T extends HTMLElement = any>({ autoFocus, children, defaultOpen, isLoading, isOpen, onOpenChange, placement, shouldFitContainer, shouldFlip, shouldRenderToParent, returnFocusRef, spacing, statusLabel, testId, trigger, zIndex, label, interactionName, strategy, }: DropdownMenuProps<T>) => React.JSX.Element;
12
+ declare const DropdownMenu: <T extends HTMLElement = any>({ autoFocus, children, defaultOpen, isLoading, isOpen, onOpenChange, placement, shouldFitContainer, shouldFlip, shouldRenderToParent, returnFocusRef, spacing, statusLabel, testId, trigger, zIndex, label, interactionName, strategy, menuLabel, }: DropdownMenuProps<T>) => React.JSX.Element;
13
13
  export default DropdownMenu;
@@ -7,5 +7,5 @@ import { type MenuWrapperProps } from '../../types';
7
7
  * if a CheckboxItem or RadioItem is clicked.
8
8
  * It also sets focus to the first menu item when opened.
9
9
  */
10
- declare const MenuWrapper: ({ children, isLoading, maxHeight, maxWidth, onClose, onUpdate, statusLabel, setInitialFocusRef, shouldRenderToParent, spacing, testId, isTriggeredUsingKeyboard, autoFocus, }: MenuWrapperProps) => JSX.Element;
10
+ declare const MenuWrapper: ({ children, isLoading, maxHeight, maxWidth, onClose, onUpdate, statusLabel, setInitialFocusRef, shouldRenderToParent, spacing, testId, isTriggeredUsingKeyboard, autoFocus, menuLabel, }: MenuWrapperProps) => JSX.Element;
11
11
  export default MenuWrapper;
@@ -181,6 +181,10 @@ interface InternalDropdownMenuProps<TriggerElement extends HTMLElement = any> {
181
181
  * The default is `fixed`.
182
182
  */
183
183
  strategy?: 'absolute' | 'fixed';
184
+ /**
185
+ * Provide an accessible label for the menu element for assistive technology.
186
+ */
187
+ menuLabel?: string;
184
188
  }
185
189
  type StandardDropdownMenuProps<TriggerElement extends HTMLElement = any> = InternalDropdownMenuProps<TriggerElement> & {
186
190
  shouldFitContainer?: false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/dropdown-menu",
3
- "version": "16.2.0",
3
+ "version": "16.3.0",
4
4
  "description": "A dropdown menu displays a list of actions or options to a user.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -27,7 +27,7 @@
27
27
  "@atlaskit/button": "^23.2.0",
28
28
  "@atlaskit/css": "^0.12.0",
29
29
  "@atlaskit/ds-lib": "^4.1.0",
30
- "@atlaskit/icon": "^27.3.0",
30
+ "@atlaskit/icon": "^27.6.0",
31
31
  "@atlaskit/layering": "^3.0.0",
32
32
  "@atlaskit/menu": "^8.0.0",
33
33
  "@atlaskit/platform-feature-flags": "^1.1.0",
@@ -35,7 +35,7 @@
35
35
  "@atlaskit/primitives": "^14.10.0",
36
36
  "@atlaskit/spinner": "^18.0.0",
37
37
  "@atlaskit/theme": "^19.0.0",
38
- "@atlaskit/tokens": "^5.5.0",
38
+ "@atlaskit/tokens": "^5.6.0",
39
39
  "@atlaskit/visually-hidden": "^3.0.0",
40
40
  "@babel/runtime": "^7.0.0",
41
41
  "bind-event-listener": "^3.0.0"
@@ -57,8 +57,8 @@
57
57
  "@atlaskit/heading": "^5.2.0",
58
58
  "@atlaskit/link": "^3.2.0",
59
59
  "@atlaskit/lozenge": "^13.0.0",
60
- "@atlaskit/modal-dialog": "^14.2.0",
61
- "@atlaskit/section-message": "^8.2.0",
60
+ "@atlaskit/modal-dialog": "^14.3.0",
61
+ "@atlaskit/section-message": "^8.3.0",
62
62
  "@atlaskit/textfield": "^8.0.0",
63
63
  "@atlaskit/toggle": "^15.0.0",
64
64
  "@atlassian/feature-flags-test-utils": "^0.3.0",
@@ -89,7 +89,7 @@
89
89
  "type": "boolean",
90
90
  "referenceOnly": true
91
91
  },
92
- "platform_design_system_team_dropdown_return_focus": {
92
+ "platform_dst_dropdown_radio_default_selected_fix": {
93
93
  "type": "boolean"
94
94
  }
95
95
  },