@atlaskit/dropdown-menu 12.23.3 → 12.24.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,22 @@
1
1
  # @atlaskit/dropdown-menu
2
2
 
3
+ ## 12.24.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#101351](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/101351)
8
+ [`53e2c361fad77`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/53e2c361fad77) -
9
+ Fixes a bug with the Dropdown Menu not returning focus to the returnFocusRef element, when
10
+ rendered in a portal. This fix is behind a feature flag.
11
+
12
+ ## 12.23.4
13
+
14
+ ### Patch Changes
15
+
16
+ - [#181817](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/181817)
17
+ [`6876e5688ed14`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/6876e5688ed14) -
18
+ Dropdown open in iframe should be closed when clicking outside of the iframe
19
+
3
20
  ## 12.23.3
4
21
 
5
22
  ### Patch Changes
@@ -24,7 +24,6 @@ var _popup = _interopRequireDefault(require("@atlaskit/popup"));
24
24
  var _constants = require("@atlaskit/theme/constants");
25
25
  var _focusManager = _interopRequireDefault(require("./internal/components/focus-manager"));
26
26
  var _menuWrapper = _interopRequireDefault(require("./internal/components/menu-wrapper"));
27
- var _dropdownMenuContext = require("./internal/context/dropdown-menu-context");
28
27
  var _selectionStore = _interopRequireDefault(require("./internal/context/selection-store"));
29
28
  var _useRegisterItemWithFocusManager = _interopRequireDefault(require("./internal/hooks/use-register-item-with-focus-manager"));
30
29
  var _useGeneratedId = _interopRequireWildcard(require("./internal/utils/use-generated-id"));
@@ -253,14 +252,14 @@ var DropdownMenu = function DropdownMenu(_ref) {
253
252
  shouldRenderToParent: shouldRenderToParent,
254
253
  strategy: strategy
255
254
  };
256
- return /*#__PURE__*/_react.default.createElement(_selectionStore.default, null, /*#__PURE__*/_react.default.createElement(_dropdownMenuContext.DropdownMenuProvider, {
257
- value: {
258
- returnFocusRef: triggerRef
259
- }
260
- }, /*#__PURE__*/_react.default.createElement(_popup.default, (0, _extends2.default)({
255
+ return /*#__PURE__*/_react.default.createElement(_selectionStore.default, null, /*#__PURE__*/_react.default.createElement(_popup.default, (0, _extends2.default)({
261
256
  id: isLocalOpen ? id : undefined,
262
257
  shouldFlip: shouldFlip,
263
258
  isOpen: isLocalOpen,
259
+ shouldReturnFocus:
260
+ // If returnFocusRef is provided, we **don't** want to return focus to the trigger.
261
+ // Otherwise, Popup will focus on the dropdown trigger after the `returnFocusRef` element is focused.
262
+ (0, _platformFeatureFlags.fg)('platform_dst_dropdown_return_focus_fix') ? returnFocusRef === undefined : undefined,
264
263
  onClose: handleOnClose,
265
264
  zIndex: zIndex,
266
265
  placement: placement,
@@ -321,6 +320,6 @@ var DropdownMenu = function DropdownMenu(_ref) {
321
320
  testId: testId && "".concat(testId, "--menu-wrapper")
322
321
  }, children));
323
322
  }
324
- }))));
323
+ })));
325
324
  };
326
325
  var _default = exports.default = DropdownMenu;
@@ -14,7 +14,6 @@ import Popup from '@atlaskit/popup';
14
14
  import { gridSize as gridSizeFn, layers } from '@atlaskit/theme/constants';
15
15
  import FocusManager from './internal/components/focus-manager';
16
16
  import MenuWrapper from './internal/components/menu-wrapper';
17
- import { DropdownMenuProvider } from './internal/context/dropdown-menu-context';
18
17
  import SelectionStore from './internal/context/selection-store';
19
18
  import useRegisterItemWithFocusManager from './internal/hooks/use-register-item-with-focus-manager';
20
19
  import useGeneratedId, { PREFIX } from './internal/utils/use-generated-id';
@@ -223,14 +222,14 @@ const DropdownMenu = ({
223
222
  shouldRenderToParent,
224
223
  strategy
225
224
  };
226
- return /*#__PURE__*/React.createElement(SelectionStore, null, /*#__PURE__*/React.createElement(DropdownMenuProvider, {
227
- value: {
228
- returnFocusRef: triggerRef
229
- }
230
- }, /*#__PURE__*/React.createElement(Popup, _extends({
225
+ return /*#__PURE__*/React.createElement(SelectionStore, null, /*#__PURE__*/React.createElement(Popup, _extends({
231
226
  id: isLocalOpen ? id : undefined,
232
227
  shouldFlip: shouldFlip,
233
228
  isOpen: isLocalOpen,
229
+ shouldReturnFocus:
230
+ // If returnFocusRef is provided, we **don't** want to return focus to the trigger.
231
+ // Otherwise, Popup will focus on the dropdown trigger after the `returnFocusRef` element is focused.
232
+ fg('platform_dst_dropdown_return_focus_fix') ? returnFocusRef === undefined : undefined,
234
233
  onClose: handleOnClose,
235
234
  zIndex: zIndex,
236
235
  placement: placement,
@@ -293,6 +292,6 @@ const DropdownMenu = ({
293
292
  autoFocus: autoFocus,
294
293
  testId: testId && `${testId}--menu-wrapper`
295
294
  }, children))
296
- }))));
295
+ })));
297
296
  };
298
297
  export default DropdownMenu;
@@ -20,7 +20,6 @@ import Popup from '@atlaskit/popup';
20
20
  import { gridSize as gridSizeFn, layers } from '@atlaskit/theme/constants';
21
21
  import FocusManager from './internal/components/focus-manager';
22
22
  import MenuWrapper from './internal/components/menu-wrapper';
23
- import { DropdownMenuProvider } from './internal/context/dropdown-menu-context';
24
23
  import SelectionStore from './internal/context/selection-store';
25
24
  import useRegisterItemWithFocusManager from './internal/hooks/use-register-item-with-focus-manager';
26
25
  import useGeneratedId, { PREFIX } from './internal/utils/use-generated-id';
@@ -244,14 +243,14 @@ var DropdownMenu = function DropdownMenu(_ref) {
244
243
  shouldRenderToParent: shouldRenderToParent,
245
244
  strategy: strategy
246
245
  };
247
- return /*#__PURE__*/React.createElement(SelectionStore, null, /*#__PURE__*/React.createElement(DropdownMenuProvider, {
248
- value: {
249
- returnFocusRef: triggerRef
250
- }
251
- }, /*#__PURE__*/React.createElement(Popup, _extends({
246
+ return /*#__PURE__*/React.createElement(SelectionStore, null, /*#__PURE__*/React.createElement(Popup, _extends({
252
247
  id: isLocalOpen ? id : undefined,
253
248
  shouldFlip: shouldFlip,
254
249
  isOpen: isLocalOpen,
250
+ shouldReturnFocus:
251
+ // If returnFocusRef is provided, we **don't** want to return focus to the trigger.
252
+ // Otherwise, Popup will focus on the dropdown trigger after the `returnFocusRef` element is focused.
253
+ fg('platform_dst_dropdown_return_focus_fix') ? returnFocusRef === undefined : undefined,
255
254
  onClose: handleOnClose,
256
255
  zIndex: zIndex,
257
256
  placement: placement,
@@ -312,6 +311,6 @@ var DropdownMenu = function DropdownMenu(_ref) {
312
311
  testId: testId && "".concat(testId, "--menu-wrapper")
313
312
  }, children));
314
313
  }
315
- }))));
314
+ })));
316
315
  };
317
316
  export default DropdownMenu;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/dropdown-menu",
3
- "version": "12.23.3",
3
+ "version": "12.24.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/"
@@ -28,7 +28,7 @@
28
28
  "@atlaskit/button": "^20.3.0",
29
29
  "@atlaskit/codemod-utils": "^4.2.0",
30
30
  "@atlaskit/ds-lib": "^3.3.0",
31
- "@atlaskit/icon": "^23.1.0",
31
+ "@atlaskit/icon": "^23.2.0",
32
32
  "@atlaskit/layering": "^1.0.0",
33
33
  "@atlaskit/menu": "^2.13.0",
34
34
  "@atlaskit/platform-feature-flags": "^0.3.0",
@@ -50,7 +50,7 @@
50
50
  "@af/integration-testing": "*",
51
51
  "@af/visual-regression": "*",
52
52
  "@atlaskit/app-provider": "^1.4.0",
53
- "@atlaskit/modal-dialog": "^12.18.0",
53
+ "@atlaskit/modal-dialog": "^12.19.0",
54
54
  "@atlaskit/toggle": "^14.0.0",
55
55
  "@atlaskit/visual-regression": "*",
56
56
  "@atlassian/feature-flags-test-utils": "*",
@@ -94,6 +94,13 @@
94
94
  "design-system-closed-all-when-click-outside": {
95
95
  "type": "boolean",
96
96
  "referenceOnly": true
97
+ },
98
+ "fix-dropdown-close-outside-iframe": {
99
+ "type": "boolean",
100
+ "referenceOnly": true
101
+ },
102
+ "platform_dst_dropdown_return_focus_fix": {
103
+ "type": "boolean"
97
104
  }
98
105
  },
99
106
  "techstack": {
@@ -1,21 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.DropdownMenuProvider = void 0;
7
- var _react = require("react");
8
- var DropdownMenuContext = /*#__PURE__*/(0, _react.createContext)(undefined);
9
-
10
- // TODO: Fill in the component {description} and ensure links point to the correct {packageName} location.
11
- // Remove links that the component does not have (such as usage). If there are no links remove them all.
12
- /**
13
- * __Dropdown menu provider__
14
- *
15
- * A dropdown menu provider {description}.
16
- *
17
- * - [Examples](https://atlassian.design/components/{packageName}/examples)
18
- * - [Code](https://atlassian.design/components/{packageName}/code)
19
- * - [Usage](https://atlassian.design/components/{packageName}/usage)
20
- */
21
- var DropdownMenuProvider = exports.DropdownMenuProvider = DropdownMenuContext.Provider;
@@ -1,15 +0,0 @@
1
- import { createContext } from 'react';
2
- const DropdownMenuContext = /*#__PURE__*/createContext(undefined);
3
-
4
- // TODO: Fill in the component {description} and ensure links point to the correct {packageName} location.
5
- // Remove links that the component does not have (such as usage). If there are no links remove them all.
6
- /**
7
- * __Dropdown menu provider__
8
- *
9
- * A dropdown menu provider {description}.
10
- *
11
- * - [Examples](https://atlassian.design/components/{packageName}/examples)
12
- * - [Code](https://atlassian.design/components/{packageName}/code)
13
- * - [Usage](https://atlassian.design/components/{packageName}/usage)
14
- */
15
- export const DropdownMenuProvider = DropdownMenuContext.Provider;
@@ -1,15 +0,0 @@
1
- import { createContext } from 'react';
2
- var DropdownMenuContext = /*#__PURE__*/createContext(undefined);
3
-
4
- // TODO: Fill in the component {description} and ensure links point to the correct {packageName} location.
5
- // Remove links that the component does not have (such as usage). If there are no links remove them all.
6
- /**
7
- * __Dropdown menu provider__
8
- *
9
- * A dropdown menu provider {description}.
10
- *
11
- * - [Examples](https://atlassian.design/components/{packageName}/examples)
12
- * - [Code](https://atlassian.design/components/{packageName}/code)
13
- * - [Usage](https://atlassian.design/components/{packageName}/usage)
14
- */
15
- export var DropdownMenuProvider = DropdownMenuContext.Provider;
@@ -1,16 +0,0 @@
1
- import { type RefObject } from 'react';
2
- interface DropdownMenuContext {
3
- returnFocusRef: RefObject<HTMLElement> | null;
4
- }
5
- declare const DropdownMenuContext: import("react").Context<DropdownMenuContext | undefined>;
6
- /**
7
- * __Dropdown menu provider__
8
- *
9
- * A dropdown menu provider {description}.
10
- *
11
- * - [Examples](https://atlassian.design/components/{packageName}/examples)
12
- * - [Code](https://atlassian.design/components/{packageName}/code)
13
- * - [Usage](https://atlassian.design/components/{packageName}/usage)
14
- */
15
- export declare const DropdownMenuProvider: import("react").Provider<DropdownMenuContext | undefined>;
16
- export {};
@@ -1,16 +0,0 @@
1
- import { type RefObject } from 'react';
2
- interface DropdownMenuContext {
3
- returnFocusRef: RefObject<HTMLElement> | null;
4
- }
5
- declare const DropdownMenuContext: import("react").Context<DropdownMenuContext | undefined>;
6
- /**
7
- * __Dropdown menu provider__
8
- *
9
- * A dropdown menu provider {description}.
10
- *
11
- * - [Examples](https://atlassian.design/components/{packageName}/examples)
12
- * - [Code](https://atlassian.design/components/{packageName}/code)
13
- * - [Usage](https://atlassian.design/components/{packageName}/usage)
14
- */
15
- export declare const DropdownMenuProvider: import("react").Provider<DropdownMenuContext | undefined>;
16
- export {};