@atlaskit/popup 6.3.0 → 6.3.1

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,16 @@
1
1
  # @atlaskit/popup
2
2
 
3
+ ## 6.3.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`1c9e0caa93d4c`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/1c9e0caa93d4c) -
8
+ Behind platform_dst-popup-trigger-initial-focus-ref: when the popup's focus trap deactivates and
9
+ shouldReturnFocus is true, an animation-frame callback now rescues focus back to the trigger
10
+ element if the browser silently dropped focus to document.body instead of returning it to the
11
+ trigger.
12
+ - Updated dependencies
13
+
3
14
  ## 6.3.0
4
15
 
5
16
  ### Minor Changes
@@ -61,6 +61,13 @@ var useFocusManager = exports.useFocusManager = function useFocusManager(_ref) {
61
61
  return function () {
62
62
  cancelAllFrames();
63
63
  focusTrap.deactivate();
64
+ if ((0, _fg.fg)('platform_dst-popup-trigger-initial-focus-ref') && shouldReturnFocus) {
65
+ requestFrame(function () {
66
+ if (triggerRef !== null && triggerRef !== void 0 && triggerRef.isConnected && (document.activeElement === document.body || document.activeElement === document.documentElement || !document.activeElement)) {
67
+ triggerRef.focus();
68
+ }
69
+ });
70
+ }
64
71
  };
65
72
  }, [popupRef, triggerRef, autoFocus, initialFocusRef, shouldCloseOnTab, shouldDisableFocusTrap, requestFrame, cancelAllFrames, shouldReturnFocus, shouldRenderToParent, currentLevel]);
66
73
  };
@@ -57,6 +57,13 @@ export const useFocusManager = ({
57
57
  return () => {
58
58
  cancelAllFrames();
59
59
  focusTrap.deactivate();
60
+ if (fg('platform_dst-popup-trigger-initial-focus-ref') && shouldReturnFocus) {
61
+ requestFrame(() => {
62
+ if (triggerRef !== null && triggerRef !== void 0 && triggerRef.isConnected && (document.activeElement === document.body || document.activeElement === document.documentElement || !document.activeElement)) {
63
+ triggerRef.focus();
64
+ }
65
+ });
66
+ }
60
67
  };
61
68
  }, [popupRef, triggerRef, autoFocus, initialFocusRef, shouldCloseOnTab, shouldDisableFocusTrap, requestFrame, cancelAllFrames, shouldReturnFocus, shouldRenderToParent, currentLevel]);
62
69
  };
@@ -54,6 +54,13 @@ export var useFocusManager = function useFocusManager(_ref) {
54
54
  return function () {
55
55
  cancelAllFrames();
56
56
  focusTrap.deactivate();
57
+ if (fg('platform_dst-popup-trigger-initial-focus-ref') && shouldReturnFocus) {
58
+ requestFrame(function () {
59
+ if (triggerRef !== null && triggerRef !== void 0 && triggerRef.isConnected && (document.activeElement === document.body || document.activeElement === document.documentElement || !document.activeElement)) {
60
+ triggerRef.focus();
61
+ }
62
+ });
63
+ }
57
64
  };
58
65
  }, [popupRef, triggerRef, autoFocus, initialFocusRef, shouldCloseOnTab, shouldDisableFocusTrap, requestFrame, cancelAllFrames, shouldReturnFocus, shouldRenderToParent, currentLevel]);
59
66
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/popup",
3
- "version": "6.3.0",
3
+ "version": "6.3.1",
4
4
  "description": "A popup displays brief content in an overlay.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -40,7 +40,7 @@
40
40
  "@atlaskit/portal": "^6.4.0",
41
41
  "@atlaskit/primitives": "^22.5.0",
42
42
  "@atlaskit/react-compiler-gating": "^0.2.0",
43
- "@atlaskit/tokens": "^16.10.0",
43
+ "@atlaskit/tokens": "^16.11.0",
44
44
  "@atlaskit/top-layer": "^4.4.0",
45
45
  "@babel/runtime": "^7.0.0",
46
46
  "@compiled/react": "^1.0.2",
@@ -116,6 +116,9 @@
116
116
  },
117
117
  "platform-dst-motion-uplift-popup": {
118
118
  "type": "boolean"
119
+ },
120
+ "platform_dst-popup-trigger-initial-focus-ref": {
121
+ "type": "boolean"
119
122
  }
120
123
  },
121
124
  "homepage": "https://atlassian.design/components/popup/"