@atlaskit/popup 1.25.0 → 1.26.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,14 @@
1
1
  # @atlaskit/popup
2
2
 
3
+ ## 1.26.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#142538](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/142538)
8
+ [`3979d0196514a`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/3979d0196514a) -
9
+ [ux] We are testing focus ring for popup wrapper `onKeyDown`. Changes are implemented behind
10
+ feature flag. If this fix is successful, it will be available in a later release.
11
+
3
12
  ## 1.25.0
4
13
 
5
14
  ### Minor Changes
@@ -18,7 +18,7 @@ var _constants = require("@atlaskit/theme/constants");
18
18
  var _popperWrapper = _interopRequireDefault(require("../popper-wrapper"));
19
19
  var _useGetMemoizedMergedTriggerRef = require("../use-get-memoized-merged-trigger-ref");
20
20
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
21
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
21
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
22
22
  var IsOpenContext = /*#__PURE__*/(0, _react.createContext)(false);
23
23
  var IdContext = /*#__PURE__*/(0, _react.createContext)(undefined);
24
24
  var TriggerRefContext = /*#__PURE__*/(0, _react.createContext)(null);
@@ -12,7 +12,9 @@ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/h
12
12
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
13
13
  var _react = require("react");
14
14
  var _react2 = require("@emotion/react");
15
+ var _focusRing = _interopRequireDefault(require("@atlaskit/focus-ring"));
15
16
  var _layering = require("@atlaskit/layering");
17
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
16
18
  var _popper = require("@atlaskit/popper");
17
19
  var _colors = require("@atlaskit/theme/colors");
18
20
  var _constants = require("@atlaskit/theme/constants");
@@ -145,7 +147,7 @@ function PopperWrapper(_ref) {
145
147
  style = _ref2.style,
146
148
  placement = _ref2.placement,
147
149
  update = _ref2.update;
148
- return (0, _react2.jsx)(PopupContainer, {
150
+ var popupContainer = (0, _react2.jsx)(PopupContainer, {
149
151
  id: id,
150
152
  "data-ds--level": currentLevel,
151
153
  "data-placement": placement,
@@ -180,6 +182,7 @@ function PopperWrapper(_ref) {
180
182
  onClose: onClose,
181
183
  setInitialFocusRef: setInitialFocusRef
182
184
  })));
185
+ return !initialFocusRef && (0, _platformFeatureFlags.fg)('platform-design-system-apply-popup-wrapper-focus') ? (0, _react2.jsx)(_focusRing.default, null, popupContainer) : popupContainer;
183
186
  });
184
187
  }
185
188
 
@@ -7,7 +7,7 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.RepositionOnUpdate = void 0;
8
8
  var _react = _interopRequireWildcard(require("react"));
9
9
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
10
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
10
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
11
11
  // eslint-disable-next-line @repo/internal/react/require-jsdoc
12
12
  var RepositionOnUpdate = exports.RepositionOnUpdate = function RepositionOnUpdate(_ref) {
13
13
  var children = _ref.children,
@@ -49,10 +49,12 @@ var useCloseManager = exports.useCloseManager = function useCloseManager(_ref) {
49
49
  }
50
50
  if (shouldDisableFocusTrap && (0, _platformFeatureFlags.fg)('platform_dst_popup-disable-focuslock')) {
51
51
  // Restoring the normal focus order for trigger.
52
- triggerRef === null || triggerRef === void 0 || triggerRef.setAttribute('tabindex', '0');
53
- if (popupRef && autoFocus) {
54
- popupRef.setAttribute('tabindex', '0');
55
- }
52
+ requestFrame(function () {
53
+ triggerRef === null || triggerRef === void 0 || triggerRef.setAttribute('tabindex', '0');
54
+ if (popupRef && autoFocus) {
55
+ popupRef.setAttribute('tabindex', '0');
56
+ }
57
+ });
56
58
  }
57
59
  };
58
60
 
@@ -5,7 +5,9 @@ import _extends from "@babel/runtime/helpers/extends";
5
5
  */
6
6
  import { forwardRef, useMemo, useState } from 'react';
7
7
  import { css, jsx } from '@emotion/react';
8
+ import FocusRing from '@atlaskit/focus-ring';
8
9
  import { UNSAFE_useLayering } from '@atlaskit/layering';
10
+ import { fg } from '@atlaskit/platform-feature-flags';
9
11
  import { Popper } from '@atlaskit/popper';
10
12
  import { N0, N50A, N60A } from '@atlaskit/theme/colors';
11
13
  import { layers } from '@atlaskit/theme/constants';
@@ -128,7 +130,7 @@ function PopperWrapper({
128
130
  placement,
129
131
  update
130
132
  }) => {
131
- return jsx(PopupContainer, {
133
+ const popupContainer = jsx(PopupContainer, {
132
134
  id: id,
133
135
  "data-ds--level": currentLevel,
134
136
  "data-placement": placement,
@@ -163,6 +165,7 @@ function PopperWrapper({
163
165
  onClose,
164
166
  setInitialFocusRef
165
167
  })));
168
+ return !initialFocusRef && fg('platform-design-system-apply-popup-wrapper-focus') ? jsx(FocusRing, null, popupContainer) : popupContainer;
166
169
  });
167
170
  }
168
171
 
@@ -44,10 +44,12 @@ export const useCloseManager = ({
44
44
  }
45
45
  if (shouldDisableFocusTrap && fg('platform_dst_popup-disable-focuslock')) {
46
46
  // Restoring the normal focus order for trigger.
47
- triggerRef === null || triggerRef === void 0 ? void 0 : triggerRef.setAttribute('tabindex', '0');
48
- if (popupRef && autoFocus) {
49
- popupRef.setAttribute('tabindex', '0');
50
- }
47
+ requestFrame(() => {
48
+ triggerRef === null || triggerRef === void 0 ? void 0 : triggerRef.setAttribute('tabindex', '0');
49
+ if (popupRef && autoFocus) {
50
+ popupRef.setAttribute('tabindex', '0');
51
+ }
52
+ });
51
53
  }
52
54
  };
53
55
 
@@ -11,7 +11,9 @@ var _css;
11
11
  */
12
12
  import { forwardRef, useMemo, useState } from 'react';
13
13
  import { css, jsx } from '@emotion/react';
14
+ import FocusRing from '@atlaskit/focus-ring';
14
15
  import { UNSAFE_useLayering } from '@atlaskit/layering';
16
+ import { fg } from '@atlaskit/platform-feature-flags';
15
17
  import { Popper } from '@atlaskit/popper';
16
18
  import { N0, N50A, N60A } from '@atlaskit/theme/colors';
17
19
  import { layers } from '@atlaskit/theme/constants';
@@ -138,7 +140,7 @@ function PopperWrapper(_ref) {
138
140
  style = _ref2.style,
139
141
  placement = _ref2.placement,
140
142
  update = _ref2.update;
141
- return jsx(PopupContainer, {
143
+ var popupContainer = jsx(PopupContainer, {
142
144
  id: id,
143
145
  "data-ds--level": currentLevel,
144
146
  "data-placement": placement,
@@ -173,6 +175,7 @@ function PopperWrapper(_ref) {
173
175
  onClose: onClose,
174
176
  setInitialFocusRef: setInitialFocusRef
175
177
  })));
178
+ return !initialFocusRef && fg('platform-design-system-apply-popup-wrapper-focus') ? jsx(FocusRing, null, popupContainer) : popupContainer;
176
179
  });
177
180
  }
178
181
 
@@ -41,10 +41,12 @@ export var useCloseManager = function useCloseManager(_ref) {
41
41
  }
42
42
  if (shouldDisableFocusTrap && fg('platform_dst_popup-disable-focuslock')) {
43
43
  // Restoring the normal focus order for trigger.
44
- triggerRef === null || triggerRef === void 0 || triggerRef.setAttribute('tabindex', '0');
45
- if (popupRef && autoFocus) {
46
- popupRef.setAttribute('tabindex', '0');
47
- }
44
+ requestFrame(function () {
45
+ triggerRef === null || triggerRef === void 0 || triggerRef.setAttribute('tabindex', '0');
46
+ if (popupRef && autoFocus) {
47
+ popupRef.setAttribute('tabindex', '0');
48
+ }
49
+ });
48
50
  }
49
51
  };
50
52
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/popup",
3
- "version": "1.25.0",
3
+ "version": "1.26.0",
4
4
  "description": "A popup displays brief content in an overlay.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -37,13 +37,14 @@
37
37
  },
38
38
  "dependencies": {
39
39
  "@atlaskit/ds-lib": "^2.5.0",
40
+ "@atlaskit/focus-ring": "^1.6.0",
40
41
  "@atlaskit/layering": "^0.4.0",
41
42
  "@atlaskit/platform-feature-flags": "^0.3.0",
42
43
  "@atlaskit/popper": "^6.3.0",
43
44
  "@atlaskit/portal": "^4.9.0",
44
45
  "@atlaskit/primitives": "^12.1.0",
45
46
  "@atlaskit/theme": "^13.0.0",
46
- "@atlaskit/tokens": "^1.59.0",
47
+ "@atlaskit/tokens": "^1.60.0",
47
48
  "@babel/runtime": "^7.0.0",
48
49
  "@emotion/react": "^11.7.1",
49
50
  "bind-event-listener": "^3.0.0",
@@ -60,7 +61,7 @@
60
61
  "@af/integration-testing": "*",
61
62
  "@af/visual-regression": "*",
62
63
  "@atlaskit/button": "^20.1.0",
63
- "@atlaskit/icon": "^22.16.0",
64
+ "@atlaskit/icon": "^22.18.0",
64
65
  "@atlaskit/ssr": "*",
65
66
  "@atlaskit/textfield": "^6.5.0",
66
67
  "@atlaskit/toggle": "^13.4.0",
@@ -114,6 +115,9 @@
114
115
  },
115
116
  "sibling-dropdown-close-issue": {
116
117
  "type": "boolean"
118
+ },
119
+ "platform-design-system-apply-popup-wrapper-focus": {
120
+ "type": "boolean"
117
121
  }
118
122
  },
119
123
  "homepage": "https://atlassian.design/components/popup/"