@atlaskit/editor-plugin-floating-toolbar 1.2.2 → 1.2.3

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,11 @@
1
1
  # @atlaskit/editor-plugin-floating-toolbar
2
2
 
3
+ ## 1.2.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [#80728](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/80728) [`aac7ad9bb32d`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/aac7ad9bb32d) - [ux] The table's floating toolbar dropdown menu a11y annnouncement.
8
+
3
9
  ## 1.2.2
4
10
 
5
11
  ### Patch Changes
@@ -17,6 +17,7 @@ var _reactIntlNext = require("react-intl-next");
17
17
  var _floatingToolbar = require("@atlaskit/editor-common/floating-toolbar");
18
18
  var _done = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/done"));
19
19
  var _menu = require("@atlaskit/menu");
20
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
20
21
  var _colors = require("@atlaskit/theme/colors");
21
22
  var _constants = require("@atlaskit/theme/constants");
22
23
  var _tooltip = _interopRequireDefault(require("@atlaskit/tooltip"));
@@ -133,6 +134,18 @@ var DropdownMenuItem = function DropdownMenuItem(_ref) {
133
134
  e.preventDefault();
134
135
  }
135
136
  }, [item.disabled]);
137
+ var isAriaChecked = function isAriaChecked(item) {
138
+ var selected = item.selected,
139
+ domItemOptions = item.domItemOptions;
140
+ if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.a11y-table-floating-toolbar-dropdown-menu_zkb33') && (domItemOptions === null || domItemOptions === void 0 ? void 0 : domItemOptions.type) === 'item-checkbox') {
141
+ return selected;
142
+ }
143
+ return undefined;
144
+ };
145
+ var hasRole = function hasRole(item) {
146
+ var domItemOptions = item.domItemOptions;
147
+ return (0, _platformFeatureFlags.getBooleanFF)('platform.editor.a11y-table-floating-toolbar-dropdown-menu_zkb33') && (domItemOptions === null || domItemOptions === void 0 ? void 0 : domItemOptions.type) === 'item-checkbox' ? 'menuitemcheckbox' : undefined;
148
+ };
136
149
  (0, _react.useEffect)(function () {
137
150
  var labelRefCurrent = labelRef.current;
138
151
  // eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
@@ -158,7 +171,9 @@ var DropdownMenuItem = function DropdownMenuItem(_ref) {
158
171
  onMouseLeave: handleItemMouseLeave,
159
172
  onMouseOut: handleItemMouseOut,
160
173
  onFocus: handleItemOnFocus,
161
- onBlur: handleItemOnBlur
174
+ onBlur: handleItemOnBlur,
175
+ role: hasRole(item),
176
+ "aria-checked": isAriaChecked(item)
162
177
  }, (0, _react2.jsx)("span", {
163
178
  ref: labelRef,
164
179
  css: labelStyles
@@ -190,7 +205,8 @@ var Dropdown = /*#__PURE__*/function (_Component) {
190
205
  intl = _this$props.intl,
191
206
  editorView = _this$props.editorView;
192
207
  return (0, _react2.jsx)("div", {
193
- css: menuContainerStyles
208
+ css: menuContainerStyles,
209
+ role: (0, _platformFeatureFlags.getBooleanFF)('platform.editor.a11y-table-floating-toolbar-dropdown-menu_zkb33') ? 'menu' : undefined
194
210
  }, items.filter(function (item) {
195
211
  return !item.hidden;
196
212
  }).map(function (item, idx) {
@@ -211,6 +227,15 @@ var Dropdown = /*#__PURE__*/function (_Component) {
211
227
  showSelected = _this$props$showSelec === void 0 ? true : _this$props$showSelec;
212
228
  var selected = item.selected;
213
229
  if (showSelected && selected) {
230
+ if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.a11y-table-floating-toolbar-dropdown-menu_zkb33')) {
231
+ return (0, _react2.jsx)("span", {
232
+ "aria-hidden": "true"
233
+ }, (0, _react2.jsx)(_done.default, {
234
+ primaryColor: "var(--ds-icon-selected, ".concat(_colors.B400, ")"),
235
+ size: "small",
236
+ label: intl.formatMessage(_floatingToolbar.messages.confirmModalOK)
237
+ }));
238
+ }
214
239
  return (0, _react2.jsx)(_done.default, {
215
240
  primaryColor: "var(--ds-icon-selected, ".concat(_colors.B400, ")"),
216
241
  size: "small",
@@ -7,6 +7,7 @@ import { injectIntl } from 'react-intl-next';
7
7
  import { messages } from '@atlaskit/editor-common/floating-toolbar';
8
8
  import EditorDoneIcon from '@atlaskit/icon/glyph/editor/done';
9
9
  import { ButtonItem } from '@atlaskit/menu';
10
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
10
11
  import { B400 } from '@atlaskit/theme/colors';
11
12
  // eslint-disable-next-line @atlaskit/design-system/no-deprecated-imports
12
13
  import { gridSize } from '@atlaskit/theme/constants';
@@ -119,6 +120,22 @@ const DropdownMenuItem = ({
119
120
  e.preventDefault();
120
121
  }
121
122
  }, [item.disabled]);
123
+ const isAriaChecked = item => {
124
+ const {
125
+ selected,
126
+ domItemOptions
127
+ } = item;
128
+ if (getBooleanFF('platform.editor.a11y-table-floating-toolbar-dropdown-menu_zkb33') && (domItemOptions === null || domItemOptions === void 0 ? void 0 : domItemOptions.type) === 'item-checkbox') {
129
+ return selected;
130
+ }
131
+ return undefined;
132
+ };
133
+ const hasRole = item => {
134
+ const {
135
+ domItemOptions
136
+ } = item;
137
+ return getBooleanFF('platform.editor.a11y-table-floating-toolbar-dropdown-menu_zkb33') && (domItemOptions === null || domItemOptions === void 0 ? void 0 : domItemOptions.type) === 'item-checkbox' ? 'menuitemcheckbox' : undefined;
138
+ };
122
139
  useEffect(() => {
123
140
  const labelRefCurrent = labelRef.current;
124
141
  // eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
@@ -144,7 +161,9 @@ const DropdownMenuItem = ({
144
161
  onMouseLeave: handleItemMouseLeave,
145
162
  onMouseOut: handleItemMouseOut,
146
163
  onFocus: handleItemOnFocus,
147
- onBlur: handleItemOnBlur
164
+ onBlur: handleItemOnBlur,
165
+ role: hasRole(item),
166
+ "aria-checked": isAriaChecked(item)
148
167
  }, jsx("span", {
149
168
  ref: labelRef,
150
169
  css: labelStyles
@@ -168,7 +187,8 @@ class Dropdown extends Component {
168
187
  editorView
169
188
  } = this.props;
170
189
  return jsx("div", {
171
- css: menuContainerStyles
190
+ css: menuContainerStyles,
191
+ role: getBooleanFF('platform.editor.a11y-table-floating-toolbar-dropdown-menu_zkb33') ? 'menu' : undefined
172
192
  }, items.filter(item => !item.hidden).map((item, idx) => jsx(DropdownMenuItem, {
173
193
  key: idx,
174
194
  item: item,
@@ -186,6 +206,15 @@ class Dropdown extends Component {
186
206
  selected
187
207
  } = item;
188
208
  if (showSelected && selected) {
209
+ if (getBooleanFF('platform.editor.a11y-table-floating-toolbar-dropdown-menu_zkb33')) {
210
+ return jsx("span", {
211
+ "aria-hidden": "true"
212
+ }, jsx(EditorDoneIcon, {
213
+ primaryColor: `var(--ds-icon-selected, ${B400})`,
214
+ size: "small",
215
+ label: intl.formatMessage(messages.confirmModalOK)
216
+ }));
217
+ }
189
218
  return jsx(EditorDoneIcon, {
190
219
  primaryColor: `var(--ds-icon-selected, ${B400})`,
191
220
  size: "small",
@@ -15,6 +15,7 @@ import { injectIntl } from 'react-intl-next';
15
15
  import { messages } from '@atlaskit/editor-common/floating-toolbar';
16
16
  import EditorDoneIcon from '@atlaskit/icon/glyph/editor/done';
17
17
  import { ButtonItem } from '@atlaskit/menu';
18
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
18
19
  import { B400 } from '@atlaskit/theme/colors';
19
20
  // eslint-disable-next-line @atlaskit/design-system/no-deprecated-imports
20
21
  import { gridSize } from '@atlaskit/theme/constants';
@@ -129,6 +130,18 @@ var DropdownMenuItem = function DropdownMenuItem(_ref) {
129
130
  e.preventDefault();
130
131
  }
131
132
  }, [item.disabled]);
133
+ var isAriaChecked = function isAriaChecked(item) {
134
+ var selected = item.selected,
135
+ domItemOptions = item.domItemOptions;
136
+ if (getBooleanFF('platform.editor.a11y-table-floating-toolbar-dropdown-menu_zkb33') && (domItemOptions === null || domItemOptions === void 0 ? void 0 : domItemOptions.type) === 'item-checkbox') {
137
+ return selected;
138
+ }
139
+ return undefined;
140
+ };
141
+ var hasRole = function hasRole(item) {
142
+ var domItemOptions = item.domItemOptions;
143
+ return getBooleanFF('platform.editor.a11y-table-floating-toolbar-dropdown-menu_zkb33') && (domItemOptions === null || domItemOptions === void 0 ? void 0 : domItemOptions.type) === 'item-checkbox' ? 'menuitemcheckbox' : undefined;
144
+ };
132
145
  useEffect(function () {
133
146
  var labelRefCurrent = labelRef.current;
134
147
  // eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
@@ -154,7 +167,9 @@ var DropdownMenuItem = function DropdownMenuItem(_ref) {
154
167
  onMouseLeave: handleItemMouseLeave,
155
168
  onMouseOut: handleItemMouseOut,
156
169
  onFocus: handleItemOnFocus,
157
- onBlur: handleItemOnBlur
170
+ onBlur: handleItemOnBlur,
171
+ role: hasRole(item),
172
+ "aria-checked": isAriaChecked(item)
158
173
  }, jsx("span", {
159
174
  ref: labelRef,
160
175
  css: labelStyles
@@ -186,7 +201,8 @@ var Dropdown = /*#__PURE__*/function (_Component) {
186
201
  intl = _this$props.intl,
187
202
  editorView = _this$props.editorView;
188
203
  return jsx("div", {
189
- css: menuContainerStyles
204
+ css: menuContainerStyles,
205
+ role: getBooleanFF('platform.editor.a11y-table-floating-toolbar-dropdown-menu_zkb33') ? 'menu' : undefined
190
206
  }, items.filter(function (item) {
191
207
  return !item.hidden;
192
208
  }).map(function (item, idx) {
@@ -207,6 +223,15 @@ var Dropdown = /*#__PURE__*/function (_Component) {
207
223
  showSelected = _this$props$showSelec === void 0 ? true : _this$props$showSelec;
208
224
  var selected = item.selected;
209
225
  if (showSelected && selected) {
226
+ if (getBooleanFF('platform.editor.a11y-table-floating-toolbar-dropdown-menu_zkb33')) {
227
+ return jsx("span", {
228
+ "aria-hidden": "true"
229
+ }, jsx(EditorDoneIcon, {
230
+ primaryColor: "var(--ds-icon-selected, ".concat(B400, ")"),
231
+ size: "small",
232
+ label: intl.formatMessage(messages.confirmModalOK)
233
+ }));
234
+ }
210
235
  return jsx(EditorDoneIcon, {
211
236
  primaryColor: "var(--ds-icon-selected, ".concat(B400, ")"),
212
237
  size: "small",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-floating-toolbar",
3
- "version": "1.2.2",
3
+ "version": "1.2.3",
4
4
  "description": "Floating toolbar plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -25,9 +25,9 @@
25
25
  },
26
26
  "dependencies": {
27
27
  "@atlaskit/adf-utils": "^19.0.0",
28
- "@atlaskit/button": "^17.7.0",
28
+ "@atlaskit/button": "^17.11.0",
29
29
  "@atlaskit/checkbox": "^13.1.0",
30
- "@atlaskit/editor-common": "^78.17.0",
30
+ "@atlaskit/editor-common": "^78.23.0",
31
31
  "@atlaskit/editor-palette": "1.5.3",
32
32
  "@atlaskit/editor-plugin-context-panel": "^1.0.0",
33
33
  "@atlaskit/editor-plugin-copy-button": "^1.0.0",
@@ -35,16 +35,16 @@
35
35
  "@atlaskit/editor-plugin-editor-disabled": "^1.0.0",
36
36
  "@atlaskit/editor-plugin-editor-viewmode": "^1.0.0",
37
37
  "@atlaskit/editor-plugin-extension": "^1.1.0",
38
- "@atlaskit/editor-plugin-table": "^7.5.0",
38
+ "@atlaskit/editor-plugin-table": "^7.6.0",
39
39
  "@atlaskit/editor-prosemirror": "3.0.0",
40
40
  "@atlaskit/emoji": "^67.6.0",
41
41
  "@atlaskit/icon": "^22.1.0",
42
42
  "@atlaskit/menu": "^2.1.0",
43
43
  "@atlaskit/modal-dialog": "^12.10.0",
44
44
  "@atlaskit/platform-feature-flags": "^0.2.5",
45
- "@atlaskit/select": "^17.3.0",
46
- "@atlaskit/theme": "^12.6.0",
47
- "@atlaskit/tokens": "^1.42.0",
45
+ "@atlaskit/select": "^17.6.0",
46
+ "@atlaskit/theme": "^12.7.0",
47
+ "@atlaskit/tokens": "^1.43.0",
48
48
  "@atlaskit/tooltip": "^18.1.0",
49
49
  "@babel/runtime": "^7.0.0",
50
50
  "@emotion/react": "^11.7.1",
@@ -109,6 +109,9 @@
109
109
  "platform-feature-flags": {
110
110
  "platform.editor.a11y-floating-toolbar-markup_vexmo": {
111
111
  "type": "boolean"
112
+ },
113
+ "platform.editor.a11y-table-floating-toolbar-dropdown-menu_zkb33": {
114
+ "type": "boolean"
112
115
  }
113
116
  }
114
117
  }