@atlaskit/editor-plugin-type-ahead 27.0.6 → 28.0.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 CHANGED
@@ -1,5 +1,35 @@
1
1
  # @atlaskit/editor-plugin-type-ahead
2
2
 
3
+ ## 28.0.0
4
+
5
+ ### Patch Changes
6
+
7
+ - [`317175303ec6a`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/317175303ec6a) -
8
+ Build the registered quick-insert menu model with `getQuickInsertMenuModel` from
9
+ `@atlaskit/editor-common`.
10
+ - Updated dependencies
11
+
12
+ ## 27.0.9
13
+
14
+ ### Patch Changes
15
+
16
+ - Updated dependencies
17
+
18
+ ## 27.0.8
19
+
20
+ ### Patch Changes
21
+
22
+ - [`b9d888e2cb530`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/b9d888e2cb530) -
23
+ Remove aria-current from selected typeahead options, behind the
24
+ `platform_editor_a11y_quick_insert_aria_current` feature gate
25
+ - Updated dependencies
26
+
27
+ ## 27.0.7
28
+
29
+ ### Patch Changes
30
+
31
+ - Updated dependencies
32
+
3
33
  ## 27.0.6
4
34
 
5
35
  ### Patch Changes
@@ -20,6 +20,7 @@ var _constants = require("@atlaskit/editor-shared-styles/constants");
20
20
  var _main = require("@atlaskit/editor-shared-styles/shortcut/main");
21
21
  var _buttonItem = _interopRequireDefault(require("@atlaskit/menu/button-item"));
22
22
  var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
23
+ var _fg = require("@atlaskit/platform-feature-flags/fg");
23
24
  var _visuallyHidden = _interopRequireDefault(require("@atlaskit/visually-hidden/visually-hidden"));
24
25
  var _SkillTagLabel = require("./SkillTagLabel");
25
26
  var _templateObject, _templateObject2, _templateObject3, _templateObject4;
@@ -268,7 +269,12 @@ var TypeAheadListItem = exports.TypeAheadListItem = /*#__PURE__*/_react.default.
268
269
  }, descriptionText, " ", shortcutText), (0, _react2.jsx)(_buttonItem.default, {
269
270
  onClick: insertSelectedItem,
270
271
  iconBefore: elementIcon,
271
- isSelected: isSelected,
272
+ isSelected: isSelected
273
+ // `aria-selected` already conveys which option is selected, so `aria-current` is
274
+ // inappropriate here (A11Y-32552). When the gate is off we fall back to the
275
+ // `aria-current="true"` that ButtonItem applies for selected items.
276
+ ,
277
+ "aria-current": !(0, _fg.fg)('platform_editor_a11y_quick_insert_aria_current') && isSelected ? 'true' : undefined,
272
278
  "aria-selected": isSelected,
273
279
  "aria-label": (_skillTag$name = skillTag === null || skillTag === void 0 ? void 0 : skillTag.name) !== null && _skillTag$name !== void 0 ? _skillTag$name : title,
274
280
  "aria-describedby": descriptionText || shortcutText ? descriptionId : undefined,
@@ -97,13 +97,14 @@ var RegisteredTypeAheadMenu = exports.RegisteredTypeAheadMenu = function Registe
97
97
  });
98
98
  }, [components]);
99
99
  var menuModel = (0, _react.useMemo)(function () {
100
- return query === '' ? (0, _registeredMenuModel.buildQuickInsertMenuModel)(components, surface.root, hasSectionOverflowItems && isSlashCommandEnabled ? _registeredMenuModel.selectQuickInsertCategoryItems : undefined, surfaceContext, triggerHandler.getRegisteredItemRank) : (0, _registeredMenuModel.getMatchingQuickInsertComponents)({
100
+ return (0, _registeredMenuModel.getQuickInsertMenuModel)({
101
101
  components: components,
102
- rootComponent: surface.root,
103
- query: query,
104
102
  formatMessage: formatMessage,
105
- surfaceContext: surfaceContext,
106
- getItemRank: triggerHandler.getRegisteredItemRank
103
+ getItemRank: triggerHandler.getRegisteredItemRank,
104
+ query: query,
105
+ rootComponent: surface.root,
106
+ selectCategoryItems: hasSectionOverflowItems && isSlashCommandEnabled ? _registeredMenuModel.selectQuickInsertCategoryItems : undefined,
107
+ surfaceContext: surfaceContext
107
108
  });
108
109
  }, [components, formatMessage, hasSectionOverflowItems, isSlashCommandEnabled, query, surfaceContext, surface.root, triggerHandler.getRegisteredItemRank]);
109
110
  var rows = (0, _react.useMemo)(function () {
@@ -17,6 +17,7 @@ import { relativeFontSizeToBase16 } from '@atlaskit/editor-shared-styles/constan
17
17
  import { shortcutStyle } from '@atlaskit/editor-shared-styles/shortcut/main';
18
18
  import ButtonItem from '@atlaskit/menu/button-item';
19
19
  import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
20
+ import { fg } from '@atlaskit/platform-feature-flags/fg';
20
21
  import VisuallyHidden from '@atlaskit/visually-hidden/visually-hidden';
21
22
  import { parseSkillTagTitle, SkillTagLabel } from './SkillTagLabel';
22
23
 
@@ -280,7 +281,12 @@ export const TypeAheadListItem = /*#__PURE__*/React.memo(({
280
281
  }, descriptionText, " ", shortcutText), jsx(ButtonItem, {
281
282
  onClick: insertSelectedItem,
282
283
  iconBefore: elementIcon,
283
- isSelected: isSelected,
284
+ isSelected: isSelected
285
+ // `aria-selected` already conveys which option is selected, so `aria-current` is
286
+ // inappropriate here (A11Y-32552). When the gate is off we fall back to the
287
+ // `aria-current="true"` that ButtonItem applies for selected items.
288
+ ,
289
+ "aria-current": !fg('platform_editor_a11y_quick_insert_aria_current') && isSelected ? 'true' : undefined,
284
290
  "aria-selected": isSelected,
285
291
  "aria-label": (_skillTag$name = skillTag === null || skillTag === void 0 ? void 0 : skillTag.name) !== null && _skillTag$name !== void 0 ? _skillTag$name : title,
286
292
  "aria-describedby": descriptionText || shortcutText ? descriptionId : undefined,
@@ -4,7 +4,7 @@ import { ax, ix } from "@compiled/react/runtime";
4
4
  import React, { useCallback, useId, useLayoutEffect, useMemo, useRef, useState, useSyncExternalStore } from 'react';
5
5
  import { useIntl } from 'react-intl';
6
6
  import Popup from '@atlaskit/editor-common/Popup';
7
- import { buildQuickInsertMenuModel, getMatchingQuickInsertComponents, getQuickInsertMenuRows, selectQuickInsertCategoryItems } from '@atlaskit/editor-common/quick-insert/registered-menu-model';
7
+ import { getQuickInsertMenuModel, getQuickInsertMenuRows, selectQuickInsertCategoryItems } from '@atlaskit/editor-common/quick-insert/registered-menu-model';
8
8
  import { useMenuPopupSizing } from '@atlaskit/editor-common/quick-insert/use-menu-popup-sizing';
9
9
  import { isSectionOverflowItemKey } from '@atlaskit/editor-common/type-ahead-is-section-overflow-item-key';
10
10
  import { TYPE_AHEAD_SURFACE_CONTEXT } from '@atlaskit/editor-common/type-ahead-surface-context';
@@ -73,13 +73,14 @@ export const RegisteredTypeAheadMenu = ({
73
73
  const hasSectionOverflowItems = useMemo(() => components.some(({
74
74
  key
75
75
  }) => isSectionOverflowItemKey(key)), [components]);
76
- const menuModel = useMemo(() => query === '' ? buildQuickInsertMenuModel(components, surface.root, hasSectionOverflowItems && isSlashCommandEnabled ? selectQuickInsertCategoryItems : undefined, surfaceContext, triggerHandler.getRegisteredItemRank) : getMatchingQuickInsertComponents({
76
+ const menuModel = useMemo(() => getQuickInsertMenuModel({
77
77
  components,
78
- rootComponent: surface.root,
79
- query,
80
78
  formatMessage,
81
- surfaceContext,
82
- getItemRank: triggerHandler.getRegisteredItemRank
79
+ getItemRank: triggerHandler.getRegisteredItemRank,
80
+ query,
81
+ rootComponent: surface.root,
82
+ selectCategoryItems: hasSectionOverflowItems && isSlashCommandEnabled ? selectQuickInsertCategoryItems : undefined,
83
+ surfaceContext
83
84
  }), [components, formatMessage, hasSectionOverflowItems, isSlashCommandEnabled, query, surfaceContext, surface.root, triggerHandler.getRegisteredItemRank]);
84
85
  const rows = useMemo(() => getQuickInsertMenuRows(menuModel), [menuModel]);
85
86
  const [previewActivation, setPreviewActivation] = useState();
@@ -19,6 +19,7 @@ import { relativeFontSizeToBase16 } from '@atlaskit/editor-shared-styles/constan
19
19
  import { shortcutStyle } from '@atlaskit/editor-shared-styles/shortcut/main';
20
20
  import ButtonItem from '@atlaskit/menu/button-item';
21
21
  import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
22
+ import { fg } from '@atlaskit/platform-feature-flags/fg';
22
23
  import VisuallyHidden from '@atlaskit/visually-hidden/visually-hidden';
23
24
  import { parseSkillTagTitle, SkillTagLabel } from './SkillTagLabel';
24
25
 
@@ -261,7 +262,12 @@ export var TypeAheadListItem = /*#__PURE__*/React.memo(function (_ref) {
261
262
  }, descriptionText, " ", shortcutText), jsx(ButtonItem, {
262
263
  onClick: insertSelectedItem,
263
264
  iconBefore: elementIcon,
264
- isSelected: isSelected,
265
+ isSelected: isSelected
266
+ // `aria-selected` already conveys which option is selected, so `aria-current` is
267
+ // inappropriate here (A11Y-32552). When the gate is off we fall back to the
268
+ // `aria-current="true"` that ButtonItem applies for selected items.
269
+ ,
270
+ "aria-current": !fg('platform_editor_a11y_quick_insert_aria_current') && isSelected ? 'true' : undefined,
265
271
  "aria-selected": isSelected,
266
272
  "aria-label": (_skillTag$name = skillTag === null || skillTag === void 0 ? void 0 : skillTag.name) !== null && _skillTag$name !== void 0 ? _skillTag$name : title,
267
273
  "aria-describedby": descriptionText || shortcutText ? descriptionId : undefined,
@@ -5,7 +5,7 @@ import { ax, ix } from "@compiled/react/runtime";
5
5
  import React, { useCallback, useId, useLayoutEffect, useMemo, useRef, useState, useSyncExternalStore } from 'react';
6
6
  import { useIntl } from 'react-intl';
7
7
  import Popup from '@atlaskit/editor-common/Popup';
8
- import { buildQuickInsertMenuModel, getMatchingQuickInsertComponents, getQuickInsertMenuRows, selectQuickInsertCategoryItems } from '@atlaskit/editor-common/quick-insert/registered-menu-model';
8
+ import { getQuickInsertMenuModel, getQuickInsertMenuRows, selectQuickInsertCategoryItems } from '@atlaskit/editor-common/quick-insert/registered-menu-model';
9
9
  import { useMenuPopupSizing } from '@atlaskit/editor-common/quick-insert/use-menu-popup-sizing';
10
10
  import { isSectionOverflowItemKey } from '@atlaskit/editor-common/type-ahead-is-section-overflow-item-key';
11
11
  import { TYPE_AHEAD_SURFACE_CONTEXT } from '@atlaskit/editor-common/type-ahead-surface-context';
@@ -88,13 +88,14 @@ export var RegisteredTypeAheadMenu = function RegisteredTypeAheadMenu(_ref) {
88
88
  });
89
89
  }, [components]);
90
90
  var menuModel = useMemo(function () {
91
- return query === '' ? buildQuickInsertMenuModel(components, surface.root, hasSectionOverflowItems && isSlashCommandEnabled ? selectQuickInsertCategoryItems : undefined, surfaceContext, triggerHandler.getRegisteredItemRank) : getMatchingQuickInsertComponents({
91
+ return getQuickInsertMenuModel({
92
92
  components: components,
93
- rootComponent: surface.root,
94
- query: query,
95
93
  formatMessage: formatMessage,
96
- surfaceContext: surfaceContext,
97
- getItemRank: triggerHandler.getRegisteredItemRank
94
+ getItemRank: triggerHandler.getRegisteredItemRank,
95
+ query: query,
96
+ rootComponent: surface.root,
97
+ selectCategoryItems: hasSectionOverflowItems && isSlashCommandEnabled ? selectQuickInsertCategoryItems : undefined,
98
+ surfaceContext: surfaceContext
98
99
  });
99
100
  }, [components, formatMessage, hasSectionOverflowItems, isSlashCommandEnabled, query, surfaceContext, surface.root, triggerHandler.getRegisteredItemRank]);
100
101
  var rows = useMemo(function () {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-type-ahead",
3
- "version": "27.0.6",
3
+ "version": "28.0.0",
4
4
  "description": "Type-ahead plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -23,11 +23,11 @@
23
23
  "dependencies": {
24
24
  "@atlaskit/adf-schema": "^57.7.0",
25
25
  "@atlaskit/css": "^1.1.0",
26
- "@atlaskit/editor-plugin-analytics": "^26.0.0",
27
- "@atlaskit/editor-plugin-connectivity": "^26.0.0",
28
- "@atlaskit/editor-plugin-context-panel": "^28.0.0",
29
- "@atlaskit/editor-plugin-metrics": "^27.0.0",
30
- "@atlaskit/editor-plugin-ui-control-registry": "^20.0.0",
26
+ "@atlaskit/editor-plugin-analytics": "^27.0.0",
27
+ "@atlaskit/editor-plugin-connectivity": "^27.0.0",
28
+ "@atlaskit/editor-plugin-context-panel": "^29.0.0",
29
+ "@atlaskit/editor-plugin-metrics": "^28.0.0",
30
+ "@atlaskit/editor-plugin-ui-control-registry": "^21.0.0",
31
31
  "@atlaskit/editor-prosemirror": "^9.0.0",
32
32
  "@atlaskit/editor-shared-styles": "^4.4.0",
33
33
  "@atlaskit/editor-ui-control-model": "^2.10.0",
@@ -35,15 +35,15 @@
35
35
  "@atlaskit/heading": "^8.0.0",
36
36
  "@atlaskit/icon": "^38.0.0",
37
37
  "@atlaskit/insm": "^3.0.0",
38
- "@atlaskit/mention": "^30.1.0",
38
+ "@atlaskit/mention": "^30.2.0",
39
39
  "@atlaskit/menu": "^11.0.0",
40
40
  "@atlaskit/platform-feature-experiments": "^0.3.0",
41
41
  "@atlaskit/platform-feature-flags": "^2.2.0",
42
42
  "@atlaskit/primitives": "^22.5.0",
43
43
  "@atlaskit/prosemirror-history": "^1.3.0",
44
44
  "@atlaskit/prosemirror-input-rules": "^4.1.0",
45
- "@atlaskit/tmp-editor-statsig": "^232.0.0",
46
- "@atlaskit/tokens": "^20.4.0",
45
+ "@atlaskit/tmp-editor-statsig": "^235.0.0",
46
+ "@atlaskit/tokens": "^20.5.0",
47
47
  "@atlaskit/visually-hidden": "^4.4.0",
48
48
  "@babel/runtime": "^7.0.0",
49
49
  "@emotion/react": "^11.7.1",
@@ -54,7 +54,7 @@
54
54
  "w3c-keyname": "^2.1.8"
55
55
  },
56
56
  "peerDependencies": {
57
- "@atlaskit/editor-common": "^130.4.0",
57
+ "@atlaskit/editor-common": "^131.0.0",
58
58
  "react": "^18.2.0 || ^19.2.0",
59
59
  "react-dom": "^18.2.0 || ^19.2.0",
60
60
  "react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
@@ -82,6 +82,9 @@
82
82
  "platform_editor_mention_typeahead_profilecard": {
83
83
  "type": "boolean"
84
84
  },
85
+ "platform_editor_a11y_quick_insert_aria_current": {
86
+ "type": "boolean"
87
+ },
85
88
  "rovo_skill_tag_slanted_background_killswitch": {
86
89
  "type": "boolean",
87
90
  "referenceOnly": true