@atlaskit/menu 2.3.1 → 2.4.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,19 @@
1
1
  # @atlaskit/menu
2
2
 
3
+ ## 2.4.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 2.4.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [#99829](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/99829)
14
+ [`1e40876a2c40`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/1e40876a2c40) -
15
+ Accessibility improvements. Adds a new `titleId` prop to Section.
16
+
3
17
  ## 2.3.1
4
18
 
5
19
  ### Patch Changes
@@ -74,10 +74,10 @@ var primitiveStyles = (0, _react2.css)({
74
74
  outline: 0,
75
75
  textDecoration: 'none',
76
76
  userSelect: 'none',
77
- '::-moz-focus-inner': {
77
+ '&::-moz-focus-inner': {
78
78
  border: 0
79
79
  },
80
- ':hover': {
80
+ '&:hover': {
81
81
  textDecoration: 'none'
82
82
  }
83
83
  });
@@ -103,14 +103,14 @@ var interactiveStyles = (0, _react2.css)({
103
103
  var unselectedStyles = (0, _react2.css)({
104
104
  backgroundColor: "var(--ds-background-neutral-subtle, transparent)",
105
105
  color: 'currentColor',
106
- ':visited': {
106
+ '&:visited': {
107
107
  color: 'currentColor'
108
108
  },
109
- ':hover': {
109
+ '&:hover': {
110
110
  backgroundColor: "var(--ds-background-neutral-subtle-hovered, ".concat(_colors.N20, ")"),
111
111
  color: 'currentColor'
112
112
  },
113
- ':active': {
113
+ '&:active': {
114
114
  backgroundColor: "var(--ds-background-neutral-subtle-pressed, ".concat(_colors.N30, ")"),
115
115
  boxShadow: 'none',
116
116
  color: 'currentColor'
@@ -150,14 +150,14 @@ var selectedStyles = (0, _react2.css)({
150
150
  backgroundColor: "var(--ds-background-selected, ".concat(_colors.N20, ")"),
151
151
  // Fallback set as babel plugin inserts one otherwise
152
152
  color: "var(--ds-text-selected, currentColor)",
153
- ':visited': {
153
+ '&:visited': {
154
154
  color: "var(--ds-text-selected, currentColor)"
155
155
  },
156
- ':hover': {
156
+ '&:hover': {
157
157
  backgroundColor: "var(--ds-background-selected-hovered, ".concat(_colors.N20, ")"),
158
158
  color: "var(--ds-text-selected, currentColor)"
159
159
  },
160
- ':active': {
160
+ '&:active': {
161
161
  backgroundColor: "var(--ds-background-selected-pressed, ".concat(_colors.N30, ")"),
162
162
  color: "var(--ds-text-selected, currentColor)"
163
163
  }
@@ -15,7 +15,7 @@ var _colors = require("@atlaskit/theme/colors");
15
15
  var _constants = require("@atlaskit/theme/constants");
16
16
  var _typography = require("@atlaskit/theme/typography");
17
17
  var _headingItem = _interopRequireDefault(require("../menu-item/heading-item"));
18
- var _excluded = ["children", "overrides", "title", "testId", "isScrollable", "hasSeparator", "id", "isList", "className"];
18
+ var _excluded = ["children", "overrides", "title", "titleId", "testId", "isScrollable", "hasSeparator", "id", "isList", "className"];
19
19
  /* eslint-disable @atlaskit/design-system/ensure-design-token-usage, @atlaskit/design-system/ensure-design-token-usage/preview */
20
20
  /** @jsx jsx */
21
21
  // eslint-disable-next-line @atlaskit/design-system/no-deprecated-imports
@@ -96,6 +96,7 @@ var Section = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
96
96
  var children = _ref.children,
97
97
  overrides = _ref.overrides,
98
98
  title = _ref.title,
99
+ titleId = _ref.titleId,
99
100
  testId = _ref.testId,
100
101
  isScrollable = _ref.isScrollable,
101
102
  hasSeparator = _ref.hasSeparator,
@@ -141,6 +142,7 @@ var Section = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
141
142
  ,
142
143
  css: [sectionStyles, isScrollable ? scrollableStyles : unscrollableStyles, hasSeparator ? (0, _platformFeatureFlags.getBooleanFF)('platform.design-system-team.section-1px-seperator-borders') ? thinSeparatorStyles : thickSeparatorStyles : noSeparatorStyles],
143
144
  "aria-label": title,
145
+ "aria-labelledby": titleId,
144
146
  "data-testid": testId,
145
147
  role: "group",
146
148
  "data-section": true,
@@ -63,10 +63,10 @@ const primitiveStyles = css({
63
63
  outline: 0,
64
64
  textDecoration: 'none',
65
65
  userSelect: 'none',
66
- '::-moz-focus-inner': {
66
+ '&::-moz-focus-inner': {
67
67
  border: 0
68
68
  },
69
- ':hover': {
69
+ '&:hover': {
70
70
  textDecoration: 'none'
71
71
  }
72
72
  });
@@ -92,14 +92,14 @@ const interactiveStyles = css({
92
92
  const unselectedStyles = css({
93
93
  backgroundColor: "var(--ds-background-neutral-subtle, transparent)",
94
94
  color: 'currentColor',
95
- ':visited': {
95
+ '&:visited': {
96
96
  color: 'currentColor'
97
97
  },
98
- ':hover': {
98
+ '&:hover': {
99
99
  backgroundColor: `var(--ds-background-neutral-subtle-hovered, ${N20})`,
100
100
  color: 'currentColor'
101
101
  },
102
- ':active': {
102
+ '&:active': {
103
103
  backgroundColor: `var(--ds-background-neutral-subtle-pressed, ${N30})`,
104
104
  boxShadow: 'none',
105
105
  color: 'currentColor'
@@ -139,14 +139,14 @@ const selectedStyles = css({
139
139
  backgroundColor: `var(--ds-background-selected, ${N20})`,
140
140
  // Fallback set as babel plugin inserts one otherwise
141
141
  color: "var(--ds-text-selected, currentColor)",
142
- ':visited': {
142
+ '&:visited': {
143
143
  color: "var(--ds-text-selected, currentColor)"
144
144
  },
145
- ':hover': {
145
+ '&:hover': {
146
146
  backgroundColor: `var(--ds-background-selected-hovered, ${N20})`,
147
147
  color: "var(--ds-text-selected, currentColor)"
148
148
  },
149
- ':active': {
149
+ '&:active': {
150
150
  backgroundColor: `var(--ds-background-selected-pressed, ${N30})`,
151
151
  color: "var(--ds-text-selected, currentColor)"
152
152
  }
@@ -87,6 +87,7 @@ const Section = /*#__PURE__*/forwardRef(({
87
87
  children,
88
88
  overrides,
89
89
  title,
90
+ titleId,
90
91
  testId,
91
92
  isScrollable,
92
93
  hasSeparator,
@@ -134,6 +135,7 @@ const Section = /*#__PURE__*/forwardRef(({
134
135
  ,
135
136
  css: [sectionStyles, isScrollable ? scrollableStyles : unscrollableStyles, hasSeparator ? getBooleanFF('platform.design-system-team.section-1px-seperator-borders') ? thinSeparatorStyles : thickSeparatorStyles : noSeparatorStyles],
136
137
  "aria-label": title,
138
+ "aria-labelledby": titleId,
137
139
  "data-testid": testId,
138
140
  role: "group",
139
141
  "data-section": true,
@@ -66,10 +66,10 @@ var primitiveStyles = css({
66
66
  outline: 0,
67
67
  textDecoration: 'none',
68
68
  userSelect: 'none',
69
- '::-moz-focus-inner': {
69
+ '&::-moz-focus-inner': {
70
70
  border: 0
71
71
  },
72
- ':hover': {
72
+ '&:hover': {
73
73
  textDecoration: 'none'
74
74
  }
75
75
  });
@@ -95,14 +95,14 @@ var interactiveStyles = css({
95
95
  var unselectedStyles = css({
96
96
  backgroundColor: "var(--ds-background-neutral-subtle, transparent)",
97
97
  color: 'currentColor',
98
- ':visited': {
98
+ '&:visited': {
99
99
  color: 'currentColor'
100
100
  },
101
- ':hover': {
101
+ '&:hover': {
102
102
  backgroundColor: "var(--ds-background-neutral-subtle-hovered, ".concat(N20, ")"),
103
103
  color: 'currentColor'
104
104
  },
105
- ':active': {
105
+ '&:active': {
106
106
  backgroundColor: "var(--ds-background-neutral-subtle-pressed, ".concat(N30, ")"),
107
107
  boxShadow: 'none',
108
108
  color: 'currentColor'
@@ -142,14 +142,14 @@ var selectedStyles = css({
142
142
  backgroundColor: "var(--ds-background-selected, ".concat(N20, ")"),
143
143
  // Fallback set as babel plugin inserts one otherwise
144
144
  color: "var(--ds-text-selected, currentColor)",
145
- ':visited': {
145
+ '&:visited': {
146
146
  color: "var(--ds-text-selected, currentColor)"
147
147
  },
148
- ':hover': {
148
+ '&:hover': {
149
149
  backgroundColor: "var(--ds-background-selected-hovered, ".concat(N20, ")"),
150
150
  color: "var(--ds-text-selected, currentColor)"
151
151
  },
152
- ':active': {
152
+ '&:active': {
153
153
  backgroundColor: "var(--ds-background-selected-pressed, ".concat(N30, ")"),
154
154
  color: "var(--ds-text-selected, currentColor)"
155
155
  }
@@ -1,6 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
- var _excluded = ["children", "overrides", "title", "testId", "isScrollable", "hasSeparator", "id", "isList", "className"];
3
+ var _excluded = ["children", "overrides", "title", "titleId", "testId", "isScrollable", "hasSeparator", "id", "isList", "className"];
4
4
  /* eslint-disable @atlaskit/design-system/ensure-design-token-usage, @atlaskit/design-system/ensure-design-token-usage/preview */
5
5
  /** @jsx jsx */
6
6
  import { Children, forwardRef, Fragment } from 'react';
@@ -89,6 +89,7 @@ var Section = /*#__PURE__*/forwardRef(function (_ref, ref) {
89
89
  var children = _ref.children,
90
90
  overrides = _ref.overrides,
91
91
  title = _ref.title,
92
+ titleId = _ref.titleId,
92
93
  testId = _ref.testId,
93
94
  isScrollable = _ref.isScrollable,
94
95
  hasSeparator = _ref.hasSeparator,
@@ -134,6 +135,7 @@ var Section = /*#__PURE__*/forwardRef(function (_ref, ref) {
134
135
  ,
135
136
  css: [sectionStyles, isScrollable ? scrollableStyles : unscrollableStyles, hasSeparator ? getBooleanFF('platform.design-system-team.section-1px-seperator-borders') ? thinSeparatorStyles : thickSeparatorStyles : noSeparatorStyles],
136
137
  "aria-label": title,
138
+ "aria-labelledby": titleId,
137
139
  "data-testid": testId,
138
140
  role: "group",
139
141
  "data-section": true,
@@ -114,6 +114,11 @@ export interface SectionProps {
114
114
  * the `HeadingItem` won't be rendered, and this component will act as a regular `Section`.
115
115
  */
116
116
  title?: string;
117
+ /**
118
+ * ID referenced by the menu group wrapper's `aria-labelledby` attribute. This ID should be assigned to the group title element.
119
+ * Usage of either this, or the `label` attribute is strongly recommended.
120
+ */
121
+ titleId?: string;
117
122
  /**
118
123
  * If your menu contains a list, use this to add `<ul>` and `<li>` tags around the items. This is essential for offering better, accessible semantic markup in a list of items.
119
124
  */
@@ -114,6 +114,11 @@ export interface SectionProps {
114
114
  * the `HeadingItem` won't be rendered, and this component will act as a regular `Section`.
115
115
  */
116
116
  title?: string;
117
+ /**
118
+ * ID referenced by the menu group wrapper's `aria-labelledby` attribute. This ID should be assigned to the group title element.
119
+ * Usage of either this, or the `label` attribute is strongly recommended.
120
+ */
121
+ titleId?: string;
117
122
  /**
118
123
  * If your menu contains a list, use this to add `<ul>` and `<li>` tags around the items. This is essential for offering better, accessible semantic markup in a list of items.
119
124
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/menu",
3
- "version": "2.3.1",
3
+ "version": "2.4.1",
4
4
  "description": "A list of options to help users navigate, or perform actions.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -46,8 +46,8 @@
46
46
  "@atlaskit/ds-lib": "^2.3.0",
47
47
  "@atlaskit/focus-ring": "^1.4.0",
48
48
  "@atlaskit/platform-feature-flags": "^0.2.0",
49
- "@atlaskit/primitives": "^6.4.0",
50
- "@atlaskit/theme": "^12.8.0",
49
+ "@atlaskit/primitives": "^7.0.0",
50
+ "@atlaskit/theme": "^12.9.0",
51
51
  "@atlaskit/tokens": "^1.49.0",
52
52
  "@babel/runtime": "^7.0.0",
53
53
  "@emotion/react": "^11.7.1"