@atlaskit/dropdown-menu 16.6.0 → 16.7.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 +17 -0
- package/dist/cjs/dropdown-menu.js +1 -2
- package/dist/cjs/internal/hooks/use-register-item-with-focus-manager.js +2 -0
- package/dist/es2019/dropdown-menu.js +1 -2
- package/dist/es2019/internal/hooks/use-register-item-with-focus-manager.js +1 -0
- package/dist/esm/dropdown-menu.js +1 -2
- package/dist/esm/internal/hooks/use-register-item-with-focus-manager.js +1 -0
- package/dist/types/internal/hooks/use-register-item-with-focus-manager.d.ts +2 -1
- package/dist/types-ts4.5/internal/hooks/use-register-item-with-focus-manager.d.ts +2 -1
- package/dropdown-menu.docs.tsx +54 -0
- package/package.json +5 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @atlaskit/dropdown-menu
|
|
2
2
|
|
|
3
|
+
## 16.7.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`35e953efa932c`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/35e953efa932c) -
|
|
8
|
+
Clean up flag to improve accessibility of dropdown menu.
|
|
9
|
+
|
|
10
|
+
### Patch Changes
|
|
11
|
+
|
|
12
|
+
- Updated dependencies
|
|
13
|
+
|
|
14
|
+
## 16.6.1
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- Updated dependencies
|
|
19
|
+
|
|
3
20
|
## 16.6.0
|
|
4
21
|
|
|
5
22
|
### Minor Changes
|
|
@@ -20,7 +20,6 @@ var _useControlled = _interopRequireDefault(require("@atlaskit/ds-lib/use-contro
|
|
|
20
20
|
var _useFocusEvent = _interopRequireDefault(require("@atlaskit/ds-lib/use-focus-event"));
|
|
21
21
|
var _chevronDown = _interopRequireDefault(require("@atlaskit/icon/core/chevron-down"));
|
|
22
22
|
var _layering = require("@atlaskit/layering");
|
|
23
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
24
23
|
var _popup = _interopRequireDefault(require("@atlaskit/popup"));
|
|
25
24
|
var _constants = require("@atlaskit/theme/constants");
|
|
26
25
|
var _focusManager = _interopRequireDefault(require("./internal/components/focus-manager"));
|
|
@@ -282,7 +281,7 @@ var DropdownMenu = function DropdownMenu(_ref) {
|
|
|
282
281
|
onClose: handleOnClose,
|
|
283
282
|
zIndex: zIndex,
|
|
284
283
|
placement: placement,
|
|
285
|
-
role: shouldRenderToParent && currentLevel > 0
|
|
284
|
+
role: shouldRenderToParent && currentLevel > 0 ? 'group' : undefined,
|
|
286
285
|
fallbackPlacements: fallbackPlacements,
|
|
287
286
|
testId: testId && "".concat(testId, "--content"),
|
|
288
287
|
shouldUseCaptureOnOutsideClick: true
|
|
@@ -7,6 +7,8 @@ exports.default = void 0;
|
|
|
7
7
|
var _react = require("react");
|
|
8
8
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
9
9
|
var _focusManager = require("../components/focus-manager");
|
|
10
|
+
// eslint-disable-next-line sort-imports
|
|
11
|
+
|
|
10
12
|
// This function is called whenever a MenuItem mounts.
|
|
11
13
|
// The refs stored in the context are used to programmatically
|
|
12
14
|
// control focus on a user navigates using the keyboard.
|
|
@@ -9,7 +9,6 @@ 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/chevron-down';
|
|
11
11
|
import { useLayering } from '@atlaskit/layering';
|
|
12
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
13
12
|
import Popup from '@atlaskit/popup';
|
|
14
13
|
// eslint-disable-next-line @atlaskit/design-system/no-deprecated-imports
|
|
15
14
|
import { layers } from '@atlaskit/theme/constants';
|
|
@@ -253,7 +252,7 @@ const DropdownMenu = ({
|
|
|
253
252
|
onClose: handleOnClose,
|
|
254
253
|
zIndex: zIndex,
|
|
255
254
|
placement: placement,
|
|
256
|
-
role: shouldRenderToParent && currentLevel > 0
|
|
255
|
+
role: shouldRenderToParent && currentLevel > 0 ? 'group' : undefined,
|
|
257
256
|
fallbackPlacements: fallbackPlacements,
|
|
258
257
|
testId: testId && `${testId}--content`,
|
|
259
258
|
shouldUseCaptureOnOutsideClick: true
|
|
@@ -15,7 +15,6 @@ 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/chevron-down';
|
|
17
17
|
import { useLayering } from '@atlaskit/layering';
|
|
18
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
19
18
|
import Popup from '@atlaskit/popup';
|
|
20
19
|
// eslint-disable-next-line @atlaskit/design-system/no-deprecated-imports
|
|
21
20
|
import { layers } from '@atlaskit/theme/constants';
|
|
@@ -274,7 +273,7 @@ var DropdownMenu = function DropdownMenu(_ref) {
|
|
|
274
273
|
onClose: handleOnClose,
|
|
275
274
|
zIndex: zIndex,
|
|
276
275
|
placement: placement,
|
|
277
|
-
role: shouldRenderToParent && currentLevel > 0
|
|
276
|
+
role: shouldRenderToParent && currentLevel > 0 ? 'group' : undefined,
|
|
278
277
|
fallbackPlacements: fallbackPlacements,
|
|
279
278
|
testId: testId && "".concat(testId, "--content"),
|
|
280
279
|
shouldUseCaptureOnOutsideClick: true
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
import { type MutableRefObject } from 'react';
|
|
2
|
+
declare function useRegisterItemWithFocusManager(hasPopup?: boolean): MutableRefObject<HTMLAnchorElement | HTMLButtonElement | null>;
|
|
2
3
|
export default useRegisterItemWithFocusManager;
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
import { type MutableRefObject } from 'react';
|
|
2
|
+
declare function useRegisterItemWithFocusManager(hasPopup?: boolean): MutableRefObject<HTMLAnchorElement | HTMLButtonElement | null>;
|
|
2
3
|
export default useRegisterItemWithFocusManager;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import path from 'path';
|
|
2
|
+
|
|
3
|
+
import type { ComponentStructuredContentSource } from '@atlassian/structured-docs-types';
|
|
4
|
+
|
|
5
|
+
const documentation: ComponentStructuredContentSource[] = [
|
|
6
|
+
{
|
|
7
|
+
name: 'DropdownMenu',
|
|
8
|
+
description: 'A dropdown menu component for displaying contextual actions and options.',
|
|
9
|
+
status: 'general-availability',
|
|
10
|
+
import: {
|
|
11
|
+
name: 'DropdownMenu',
|
|
12
|
+
package: '@atlaskit/dropdown-menu',
|
|
13
|
+
type: 'default',
|
|
14
|
+
packagePath: path.resolve(__dirname),
|
|
15
|
+
packageJson: require('./package.json'),
|
|
16
|
+
},
|
|
17
|
+
usageGuidelines: [
|
|
18
|
+
'Use for 5–15 items; navigation or command (action on selection)',
|
|
19
|
+
'Avoid truncation—check max width; avoid truncated labels',
|
|
20
|
+
'Nested menu: maximum two layers',
|
|
21
|
+
'In a modal, use shouldRenderToParent for correct focus and screen reader behavior',
|
|
22
|
+
'Disabled triggers are not supported (see Button a11y)',
|
|
23
|
+
'Use Select for search/select; Checkbox for multiple from list; Radio for short single choice',
|
|
24
|
+
],
|
|
25
|
+
contentGuidelines: [
|
|
26
|
+
'Logical order (e.g. most selected first); group with uppercase section title',
|
|
27
|
+
'Use verbs for actions, nouns for links; no articles; single line per item',
|
|
28
|
+
'Use clear, descriptive menu item labels',
|
|
29
|
+
'Keep menu item text concise',
|
|
30
|
+
'Group related actions logically',
|
|
31
|
+
'Use consistent terminology across menu items',
|
|
32
|
+
],
|
|
33
|
+
accessibilityGuidelines: [
|
|
34
|
+
'Avoid truncation—ensure max width does not cut off labels',
|
|
35
|
+
'Focus lock when open; keyboard open should focus first item',
|
|
36
|
+
'Nested menu: maximum two layers',
|
|
37
|
+
'In modal use shouldRenderToParent for focus and voicing',
|
|
38
|
+
'Provide clear labels for dropdown triggers',
|
|
39
|
+
'Ensure keyboard navigation with arrow keys',
|
|
40
|
+
'Use appropriate ARIA attributes',
|
|
41
|
+
],
|
|
42
|
+
examples: [
|
|
43
|
+
{
|
|
44
|
+
name: 'Dropdown Menu',
|
|
45
|
+
description: 'Dropdown Menu example',
|
|
46
|
+
source: path.resolve(__dirname, './examples/ai/dropdown-menu.tsx'),
|
|
47
|
+
},
|
|
48
|
+
],
|
|
49
|
+
keywords: ['dropdown', 'menu', 'actions', 'options', 'popup', 'contextual'],
|
|
50
|
+
categories: ['navigation', 'interaction'],
|
|
51
|
+
},
|
|
52
|
+
];
|
|
53
|
+
|
|
54
|
+
export default documentation;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/dropdown-menu",
|
|
3
|
-
"version": "16.
|
|
3
|
+
"version": "16.7.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/"
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@atlaskit/button": "^23.10.0",
|
|
28
28
|
"@atlaskit/css": "^0.19.0",
|
|
29
|
-
"@atlaskit/ds-lib": "^
|
|
30
|
-
"@atlaskit/icon": "^32.
|
|
29
|
+
"@atlaskit/ds-lib": "^6.0.0",
|
|
30
|
+
"@atlaskit/icon": "^32.1.0",
|
|
31
31
|
"@atlaskit/layering": "^3.6.0",
|
|
32
32
|
"@atlaskit/menu": "^8.4.0",
|
|
33
33
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"@atlaskit/atlassian-navigation": "^5.6.0",
|
|
53
53
|
"@atlaskit/avatar": "^25.8.0",
|
|
54
54
|
"@atlaskit/checkbox": "^17.3.0",
|
|
55
|
-
"@atlaskit/docs": "^11.
|
|
55
|
+
"@atlaskit/docs": "^11.7.0",
|
|
56
56
|
"@atlaskit/form": "^15.4.0",
|
|
57
57
|
"@atlaskit/heading": "^5.3.0",
|
|
58
58
|
"@atlaskit/link": "^3.3.0",
|
|
@@ -63,6 +63,7 @@
|
|
|
63
63
|
"@atlaskit/toggle": "^15.2.0",
|
|
64
64
|
"@atlassian/a11y-jest-testing": "^0.10.0",
|
|
65
65
|
"@atlassian/feature-flags-test-utils": "^1.0.0",
|
|
66
|
+
"@atlassian/structured-docs-types": "workspace:^",
|
|
66
67
|
"@testing-library/react": "^16.3.0",
|
|
67
68
|
"@testing-library/user-event": "^14.4.3",
|
|
68
69
|
"jest-in-case": "^1.0.2",
|
|
@@ -84,9 +85,6 @@
|
|
|
84
85
|
"platform_dst_dropdown_radio_default_selected_fix": {
|
|
85
86
|
"type": "boolean"
|
|
86
87
|
},
|
|
87
|
-
"platform-dst-nested-dropdown-menu-role": {
|
|
88
|
-
"type": "boolean"
|
|
89
|
-
},
|
|
90
88
|
"platform_dst_menu_item_focus": {
|
|
91
89
|
"type": "boolean"
|
|
92
90
|
}
|