@atlaskit/dropdown-menu 12.18.1 → 12.18.2
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,15 @@
|
|
|
1
1
|
# @atlaskit/dropdown-menu
|
|
2
2
|
|
|
3
|
+
## 12.18.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#139091](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/139091)
|
|
8
|
+
[`142645f92833a`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/142645f92833a) -
|
|
9
|
+
Fix a bug that caused the launch button to lose the ability to focus after closing a popup window
|
|
10
|
+
by pressing the Tab key that opened from a dropdown menu. This problem was reproduced only when
|
|
11
|
+
the `platform_dst_popup-disable-focuslock` feature flag was enabled.
|
|
12
|
+
|
|
3
13
|
## 12.18.1
|
|
4
14
|
|
|
5
15
|
### Patch Changes
|
|
@@ -7,6 +7,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.default = handleFocus;
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
9
|
var _keycodes = require("@atlaskit/ds-lib/keycodes");
|
|
10
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
11
|
+
var _useGeneratedId = require("./use-generated-id");
|
|
10
12
|
var _actionMap;
|
|
11
13
|
var actionMap = (_actionMap = {}, (0, _defineProperty2.default)(_actionMap, _keycodes.KEY_DOWN, 'next'), (0, _defineProperty2.default)(_actionMap, _keycodes.KEY_UP, 'prev'), (0, _defineProperty2.default)(_actionMap, _keycodes.KEY_HOME, 'first'), (0, _defineProperty2.default)(_actionMap, _keycodes.KEY_END, 'last'), _actionMap);
|
|
12
14
|
|
|
@@ -47,15 +49,29 @@ function handleFocus(refs, isLayerDisabled, onClose) {
|
|
|
47
49
|
var _document$activeEleme;
|
|
48
50
|
return (_document$activeEleme = document.activeElement) === null || _document$activeEleme === void 0 ? void 0 : _document$activeEleme.isSameNode(el);
|
|
49
51
|
});
|
|
50
|
-
if (
|
|
51
|
-
|
|
52
|
-
if
|
|
53
|
-
|
|
52
|
+
if ((0, _platformFeatureFlags.fg)('platform_dst_popup-disable-focuslock')) {
|
|
53
|
+
var _document$activeEleme2;
|
|
54
|
+
// if we use a popup as a nested dropdown, we must prevent the dropdown from closing.
|
|
55
|
+
var isNestedDropdown = !!((_document$activeEleme2 = document.activeElement) !== null && _document$activeEleme2 !== void 0 && _document$activeEleme2.closest("[id^=".concat(_useGeneratedId.PREFIX, "]")));
|
|
56
|
+
if (isLayerDisabled() && isNestedDropdown) {
|
|
57
|
+
if (e.key === _keycodes.KEY_TAB && !e.shiftKey) {
|
|
58
|
+
onClose(e);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// if it is a nested dropdown and the level of the given dropdown is not the current level,
|
|
62
|
+
// we don't need to have focus on it
|
|
63
|
+
return;
|
|
54
64
|
}
|
|
65
|
+
} else {
|
|
66
|
+
if (isLayerDisabled()) {
|
|
67
|
+
if (e.key === _keycodes.KEY_TAB && !e.shiftKey) {
|
|
68
|
+
onClose(e);
|
|
69
|
+
}
|
|
55
70
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
71
|
+
// if it is a nested dropdown and the level of the given dropdown is not the current level,
|
|
72
|
+
// we don't need to have focus on it
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
59
75
|
}
|
|
60
76
|
var action = actionMap[e.key];
|
|
61
77
|
switch (action) {
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { KEY_DOWN, KEY_END, KEY_HOME, KEY_TAB, KEY_UP } from '@atlaskit/ds-lib/keycodes';
|
|
2
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
3
|
+
import { PREFIX } from './use-generated-id';
|
|
2
4
|
const actionMap = {
|
|
3
5
|
[KEY_DOWN]: 'next',
|
|
4
6
|
[KEY_UP]: 'prev',
|
|
@@ -43,15 +45,29 @@ export default function handleFocus(refs, isLayerDisabled, onClose) {
|
|
|
43
45
|
var _document$activeEleme;
|
|
44
46
|
return (_document$activeEleme = document.activeElement) === null || _document$activeEleme === void 0 ? void 0 : _document$activeEleme.isSameNode(el);
|
|
45
47
|
});
|
|
46
|
-
if (
|
|
47
|
-
|
|
48
|
-
if
|
|
49
|
-
|
|
48
|
+
if (fg('platform_dst_popup-disable-focuslock')) {
|
|
49
|
+
var _document$activeEleme2;
|
|
50
|
+
// if we use a popup as a nested dropdown, we must prevent the dropdown from closing.
|
|
51
|
+
const isNestedDropdown = !!((_document$activeEleme2 = document.activeElement) !== null && _document$activeEleme2 !== void 0 && _document$activeEleme2.closest(`[id^=${PREFIX}]`));
|
|
52
|
+
if (isLayerDisabled() && isNestedDropdown) {
|
|
53
|
+
if (e.key === KEY_TAB && !e.shiftKey) {
|
|
54
|
+
onClose(e);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// if it is a nested dropdown and the level of the given dropdown is not the current level,
|
|
58
|
+
// we don't need to have focus on it
|
|
59
|
+
return;
|
|
50
60
|
}
|
|
61
|
+
} else {
|
|
62
|
+
if (isLayerDisabled()) {
|
|
63
|
+
if (e.key === KEY_TAB && !e.shiftKey) {
|
|
64
|
+
onClose(e);
|
|
65
|
+
}
|
|
51
66
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
67
|
+
// if it is a nested dropdown and the level of the given dropdown is not the current level,
|
|
68
|
+
// we don't need to have focus on it
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
55
71
|
}
|
|
56
72
|
const action = actionMap[e.key];
|
|
57
73
|
switch (action) {
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
var _actionMap;
|
|
3
3
|
import { KEY_DOWN, KEY_END, KEY_HOME, KEY_TAB, KEY_UP } from '@atlaskit/ds-lib/keycodes';
|
|
4
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
5
|
+
import { PREFIX } from './use-generated-id';
|
|
4
6
|
var actionMap = (_actionMap = {}, _defineProperty(_actionMap, KEY_DOWN, 'next'), _defineProperty(_actionMap, KEY_UP, 'prev'), _defineProperty(_actionMap, KEY_HOME, 'first'), _defineProperty(_actionMap, KEY_END, 'last'), _actionMap);
|
|
5
7
|
|
|
6
8
|
/**
|
|
@@ -40,15 +42,29 @@ export default function handleFocus(refs, isLayerDisabled, onClose) {
|
|
|
40
42
|
var _document$activeEleme;
|
|
41
43
|
return (_document$activeEleme = document.activeElement) === null || _document$activeEleme === void 0 ? void 0 : _document$activeEleme.isSameNode(el);
|
|
42
44
|
});
|
|
43
|
-
if (
|
|
44
|
-
|
|
45
|
-
if
|
|
46
|
-
|
|
45
|
+
if (fg('platform_dst_popup-disable-focuslock')) {
|
|
46
|
+
var _document$activeEleme2;
|
|
47
|
+
// if we use a popup as a nested dropdown, we must prevent the dropdown from closing.
|
|
48
|
+
var isNestedDropdown = !!((_document$activeEleme2 = document.activeElement) !== null && _document$activeEleme2 !== void 0 && _document$activeEleme2.closest("[id^=".concat(PREFIX, "]")));
|
|
49
|
+
if (isLayerDisabled() && isNestedDropdown) {
|
|
50
|
+
if (e.key === KEY_TAB && !e.shiftKey) {
|
|
51
|
+
onClose(e);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// if it is a nested dropdown and the level of the given dropdown is not the current level,
|
|
55
|
+
// we don't need to have focus on it
|
|
56
|
+
return;
|
|
47
57
|
}
|
|
58
|
+
} else {
|
|
59
|
+
if (isLayerDisabled()) {
|
|
60
|
+
if (e.key === KEY_TAB && !e.shiftKey) {
|
|
61
|
+
onClose(e);
|
|
62
|
+
}
|
|
48
63
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
64
|
+
// if it is a nested dropdown and the level of the given dropdown is not the current level,
|
|
65
|
+
// we don't need to have focus on it
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
52
68
|
}
|
|
53
69
|
var action = actionMap[e.key];
|
|
54
70
|
switch (action) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/dropdown-menu",
|
|
3
|
-
"version": "12.18.
|
|
3
|
+
"version": "12.18.2",
|
|
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/"
|
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
"@atlaskit/icon": "^22.16.0",
|
|
30
30
|
"@atlaskit/layering": "^0.4.0",
|
|
31
31
|
"@atlaskit/menu": "^2.12.0",
|
|
32
|
+
"@atlaskit/platform-feature-flags": "^0.3.0",
|
|
32
33
|
"@atlaskit/popup": "^1.25.0",
|
|
33
34
|
"@atlaskit/primitives": "^12.1.0",
|
|
34
35
|
"@atlaskit/spinner": "^16.3.0",
|
|
@@ -70,16 +71,7 @@
|
|
|
70
71
|
],
|
|
71
72
|
"platform-feature-flags": {
|
|
72
73
|
"platform_dst_popup-disable-focuslock": {
|
|
73
|
-
"type": "boolean"
|
|
74
|
-
"referenceOnly": true
|
|
75
|
-
},
|
|
76
|
-
"sibling-dropdown-close-issue": {
|
|
77
|
-
"type": "boolean",
|
|
78
|
-
"referenceOnly": true
|
|
79
|
-
},
|
|
80
|
-
"design-system-closed-all-when-click-outside": {
|
|
81
|
-
"type": "boolean",
|
|
82
|
-
"referenceOnly": true
|
|
74
|
+
"type": "boolean"
|
|
83
75
|
}
|
|
84
76
|
},
|
|
85
77
|
"techstack": {
|