@atlaskit/editor-common 78.37.0 → 78.37.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.
Files changed (44) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/dist/cjs/element-browser/components/CategoryList.js +89 -8
  3. package/dist/cjs/element-browser/components/ElementList/ElementList.js +30 -4
  4. package/dist/cjs/element-browser/components/StatelessElementBrowser.js +77 -12
  5. package/dist/cjs/element-browser/hooks/use-select-and-focus-on-arrow-navigation.js +38 -4
  6. package/dist/cjs/messages/insert-block.js +9 -4
  7. package/dist/cjs/monitoring/error.js +1 -1
  8. package/dist/cjs/styles/index.js +7 -0
  9. package/dist/cjs/styles/shared/background-color.js +15 -0
  10. package/dist/cjs/ui/DropList/index.js +1 -1
  11. package/dist/cjs/ui/FloatingToolbar/Separator.js +2 -1
  12. package/dist/es2019/element-browser/components/CategoryList.js +96 -12
  13. package/dist/es2019/element-browser/components/ElementList/ElementList.js +29 -3
  14. package/dist/es2019/element-browser/components/StatelessElementBrowser.js +78 -13
  15. package/dist/es2019/element-browser/hooks/use-select-and-focus-on-arrow-navigation.js +39 -5
  16. package/dist/es2019/messages/insert-block.js +9 -4
  17. package/dist/es2019/monitoring/error.js +1 -1
  18. package/dist/es2019/styles/index.js +1 -0
  19. package/dist/es2019/styles/shared/background-color.js +9 -0
  20. package/dist/es2019/ui/DropList/index.js +1 -1
  21. package/dist/es2019/ui/FloatingToolbar/Separator.js +2 -1
  22. package/dist/esm/element-browser/components/CategoryList.js +89 -9
  23. package/dist/esm/element-browser/components/ElementList/ElementList.js +30 -4
  24. package/dist/esm/element-browser/components/StatelessElementBrowser.js +78 -13
  25. package/dist/esm/element-browser/hooks/use-select-and-focus-on-arrow-navigation.js +38 -4
  26. package/dist/esm/messages/insert-block.js +9 -4
  27. package/dist/esm/monitoring/error.js +1 -1
  28. package/dist/esm/styles/index.js +1 -0
  29. package/dist/esm/styles/shared/background-color.js +9 -0
  30. package/dist/esm/ui/DropList/index.js +1 -1
  31. package/dist/esm/ui/FloatingToolbar/Separator.js +2 -1
  32. package/dist/types/element-browser/components/CategoryList.d.ts +5 -0
  33. package/dist/types/element-browser/components/ElementList/ElementList.d.ts +2 -0
  34. package/dist/types/element-browser/hooks/use-select-and-focus-on-arrow-navigation.d.ts +4 -1
  35. package/dist/types/messages/insert-block.d.ts +5 -0
  36. package/dist/types/styles/index.d.ts +1 -0
  37. package/dist/types/styles/shared/background-color.d.ts +1 -0
  38. package/dist/types-ts4.5/element-browser/components/CategoryList.d.ts +5 -0
  39. package/dist/types-ts4.5/element-browser/components/ElementList/ElementList.d.ts +2 -0
  40. package/dist/types-ts4.5/element-browser/hooks/use-select-and-focus-on-arrow-navigation.d.ts +4 -1
  41. package/dist/types-ts4.5/messages/insert-block.d.ts +5 -0
  42. package/dist/types-ts4.5/styles/index.d.ts +1 -0
  43. package/dist/types-ts4.5/styles/shared/background-color.d.ts +1 -0
  44. package/package.json +8 -5
package/CHANGELOG.md CHANGED
@@ -1,5 +1,29 @@
1
1
  # @atlaskit/editor-common
2
2
 
3
+ ## 78.37.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#93090](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/93090)
8
+ [`cd31395a7c4d`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/cd31395a7c4d) -
9
+ ECA11Y-204 fix element browser focus order
10
+
11
+ ## 78.37.1
12
+
13
+ ### Patch Changes
14
+
15
+ - [#95715](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/95715)
16
+ [`f036f2fd9ccf`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/f036f2fd9ccf) -
17
+ [ED-23102] Added global styles that map the custom CSS variables to background color for
18
+ background color mark
19
+ - [#96198](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/96198)
20
+ [`b69d14268915`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/b69d14268915) -
21
+ [ux] EDF-629 fixed floating toolbar elements stealing selection from editor
22
+ - [#96234](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/96234)
23
+ [`d414d3e7503b`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/d414d3e7503b) -
24
+ Update copy for Loom toolbar tooltip item and quickinsert description
25
+ - Updated dependencies
26
+
3
27
  ## 78.37.0
4
28
 
5
29
  ### Minor Changes
@@ -14,6 +14,7 @@ var _react = _interopRequireWildcard(require("react"));
14
14
  var _react2 = require("@emotion/react");
15
15
  var _analyticsNext = require("@atlaskit/analytics-next");
16
16
  var _customThemeButton = _interopRequireDefault(require("@atlaskit/button/custom-theme-button"));
17
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
17
18
  var _colors = require("@atlaskit/theme/colors");
18
19
  var _analytics = require("../../analytics");
19
20
  var _constants = require("../constants");
@@ -25,22 +26,56 @@ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return
25
26
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
26
27
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
27
28
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
29
+ var arrowsKeys = new Set(['ArrowUp', 'ArrowDown']);
28
30
  function CategoryList(_ref) {
29
31
  var _ref$categories = _ref.categories,
30
32
  categories = _ref$categories === void 0 ? [] : _ref$categories,
31
33
  props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
32
34
  var _React$useState = _react.default.useState(null),
33
35
  _React$useState2 = (0, _slicedToArray2.default)(_React$useState, 2),
34
- focusedCategoryIndex = _React$useState2[0],
35
- setFocusedCategoryIndex = _React$useState2[1];
36
+ focusedCategoryIndexState = _React$useState2[0],
37
+ setFocusedCategoryIndexState = _React$useState2[1];
38
+ var focusedCategoryIndexProp = props.focusedCategoryIndex,
39
+ setFocusedCategoryIndexProp = props.setFocusedCategoryIndex,
40
+ onSelectCategory = props.onSelectCategory;
41
+ var focusedCategoryIndex = (0, _platformFeatureFlags.getBooleanFF)('platform.editor.a11y-focus-order-for-element-browser-categories_ztiw1') ? focusedCategoryIndexProp : focusedCategoryIndexState;
42
+ var setFocusedCategoryIndex = (0, _platformFeatureFlags.getBooleanFF)('platform.editor.a11y-focus-order-for-element-browser-categories_ztiw1') ? setFocusedCategoryIndexProp : setFocusedCategoryIndexState;
36
43
  return (0, _react2.jsx)(_react.Fragment, null, categories.map(function (category, index) {
44
+ var categoriesLength = categories === null || categories === void 0 ? void 0 : categories.length;
45
+ var selectNextCategory;
46
+ var selectPreviousCategory;
47
+ if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.a11y-focus-order-for-element-browser-categories_ztiw1') && categoriesLength > 1) {
48
+ selectNextCategory = function selectNextCategory() {
49
+ if (index !== categoriesLength - 1) {
50
+ setFocusedCategoryIndex(index + 1);
51
+ onSelectCategory(categories[index + 1]);
52
+ } else {
53
+ setFocusedCategoryIndex(0);
54
+ onSelectCategory(categories[0]);
55
+ }
56
+ return;
57
+ };
58
+ selectPreviousCategory = function selectPreviousCategory() {
59
+ if (index !== 0) {
60
+ setFocusedCategoryIndex(index - 1);
61
+ onSelectCategory(categories[index - 1]);
62
+ } else {
63
+ setFocusedCategoryIndex(categoriesLength - 1);
64
+ onSelectCategory(categories[categoriesLength - 1]);
65
+ }
66
+ return;
67
+ };
68
+ }
37
69
  return (0, _react2.jsx)(CategoryListItem, (0, _extends2.default)({
38
70
  key: category.title,
39
71
  index: index,
40
72
  category: category,
41
- focus: focusedCategoryIndex === index,
42
- setFocusedCategoryIndex: setFocusedCategoryIndex
43
- }, props));
73
+ focus: focusedCategoryIndex === index
74
+ }, props, {
75
+ setFocusedCategoryIndex: setFocusedCategoryIndex,
76
+ selectPreviousCategory: selectPreviousCategory,
77
+ selectNextCategory: selectNextCategory
78
+ }));
44
79
  }));
45
80
  }
46
81
  function CategoryListItem(_ref2) {
@@ -50,10 +85,16 @@ function CategoryListItem(_ref2) {
50
85
  index = _ref2.index,
51
86
  focus = _ref2.focus,
52
87
  setFocusedCategoryIndex = _ref2.setFocusedCategoryIndex,
53
- createAnalyticsEvent = _ref2.createAnalyticsEvent;
88
+ createAnalyticsEvent = _ref2.createAnalyticsEvent,
89
+ setFocusedItemIndex = _ref2.setFocusedItemIndex,
90
+ setFocusOnSearch = _ref2.setFocusOnSearch,
91
+ selectPreviousCategory = _ref2.selectPreviousCategory,
92
+ selectNextCategory = _ref2.selectNextCategory;
54
93
  var ref = (0, _useFocus.default)(focus);
55
94
  var onClick = (0, _react.useCallback)(function () {
56
- onSelectCategory(category);
95
+ if (!(0, _platformFeatureFlags.getBooleanFF)('platform.editor.a11y-focus-order-for-element-browser-categories_ztiw1')) {
96
+ onSelectCategory(category);
97
+ }
57
98
  /**
58
99
  * When user double clicks on same category, focus on first item.
59
100
  */
@@ -62,6 +103,9 @@ function CategoryListItem(_ref2) {
62
103
  } else {
63
104
  setFocusedCategoryIndex(index);
64
105
  }
106
+ if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.a11y-focus-order-for-element-browser-categories_ztiw1')) {
107
+ onSelectCategory(category);
108
+ }
65
109
  (0, _analytics.fireAnalyticsEvent)(createAnalyticsEvent)({
66
110
  payload: {
67
111
  action: _analytics.ACTION.CLICKED,
@@ -92,6 +136,41 @@ function CategoryListItem(_ref2) {
92
136
  })
93
137
  }, rest);
94
138
  }, [category.name, selectedCategory]);
139
+ var onTabPress = (0, _react.useCallback)(function (e) {
140
+ var isShiftPressed = e.shiftKey;
141
+ if (!isShiftPressed) {
142
+ // set focus from focused category to first item in it
143
+ if (setFocusedItemIndex) {
144
+ setFocusedItemIndex(0);
145
+ e.preventDefault();
146
+ }
147
+ } else {
148
+ // jump from first category back to search
149
+ if (setFocusOnSearch) {
150
+ setFocusOnSearch();
151
+ e.preventDefault();
152
+ }
153
+ }
154
+ return;
155
+ }, [setFocusedItemIndex, setFocusOnSearch]);
156
+ var onArrowPress = (0, _react.useCallback)(function (e) {
157
+ if (e.key === 'ArrowUp' && selectPreviousCategory) {
158
+ return selectPreviousCategory();
159
+ }
160
+ if (e.key === 'ArrowDown' && selectNextCategory) {
161
+ return selectNextCategory();
162
+ }
163
+ }, [selectPreviousCategory, selectNextCategory]);
164
+ var onKeyDown = (0, _react.useCallback)(function (e) {
165
+ var isTabPressed = e.key === 'Tab';
166
+ var isArrowPressed = arrowsKeys.has(e.key);
167
+ if (isTabPressed) {
168
+ return onTabPress(e);
169
+ }
170
+ if (isArrowPressed) {
171
+ return onArrowPress(e);
172
+ }
173
+ }, [onTabPress, onArrowPress]);
95
174
  return (0, _react2.jsx)("div", {
96
175
  css: buttonWrapper,
97
176
  role: "presentation"
@@ -100,13 +179,15 @@ function CategoryListItem(_ref2) {
100
179
  isSelected: selectedCategory === category.name,
101
180
  onClick: onClick,
102
181
  onFocus: onFocus,
182
+ onKeyDown: (0, _platformFeatureFlags.getBooleanFF)('platform.editor.a11y-focus-order-for-element-browser-categories_ztiw1') ? onKeyDown : undefined,
103
183
  theme: getTheme,
104
184
  role: "tab",
105
185
  "aria-selected": selectedCategory === category.name ? 'true' : 'false',
106
186
  "aria-controls": "browse-category-".concat(category.name, "-tab"),
107
187
  id: "browse-category--".concat(category.name, "-button"),
108
188
  ref: ref,
109
- testId: "element-browser-category-item"
189
+ testId: "element-browser-category-item",
190
+ tabIndex: -1
110
191
  }, category.title));
111
192
  }
112
193
  var buttonWrapper = (0, _react2.css)((0, _defineProperty2.default)({
@@ -18,6 +18,7 @@ var _analyticsNext = require("@atlaskit/analytics-next");
18
18
  var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
19
19
  var _shortcut = require("@atlaskit/editor-shared-styles/shortcut");
20
20
  var _menu = require("@atlaskit/menu");
21
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
21
22
  var _colors = require("@atlaskit/theme/colors");
22
23
  var _constants = require("@atlaskit/theme/constants");
23
24
  var _tooltip = _interopRequireDefault(require("@atlaskit/tooltip"));
@@ -30,7 +31,7 @@ var _types = require("../../types");
30
31
  var _cellSizeAndPositionGetter = _interopRequireDefault(require("./cellSizeAndPositionGetter"));
31
32
  var _EmptyState = _interopRequireDefault(require("./EmptyState"));
32
33
  var _utils = require("./utils");
33
- var _excluded = ["items", "mode", "selectedItemIndex", "focusedItemIndex", "setColumnCount", "createAnalyticsEvent", "emptyStateHandler", "selectedCategory", "searchTerm"];
34
+ var _excluded = ["items", "mode", "selectedItemIndex", "focusedItemIndex", "setColumnCount", "createAnalyticsEvent", "emptyStateHandler", "selectedCategory", "selectedCategoryIndex", "searchTerm", "setFocusedCategoryIndex", "setFocusedItemIndex"];
34
35
  /** @jsx jsx */
35
36
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
36
37
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
@@ -60,7 +61,10 @@ function ElementList(_ref) {
60
61
  createAnalyticsEvent = _ref.createAnalyticsEvent,
61
62
  emptyStateHandler = _ref.emptyStateHandler,
62
63
  selectedCategory = _ref.selectedCategory,
64
+ selectedCategoryIndex = _ref.selectedCategoryIndex,
63
65
  searchTerm = _ref.searchTerm,
66
+ setFocusedCategoryIndex = _ref.setFocusedCategoryIndex,
67
+ setFocusedItemIndex = _ref.setFocusedItemIndex,
64
68
  props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
65
69
  var _useContainerWidth = (0, _useContainerWidth2.default)(),
66
70
  containerWidth = _useContainerWidth.containerWidth,
@@ -104,16 +108,38 @@ function ElementList(_ref) {
104
108
  style: style,
105
109
  key: key,
106
110
  className: "element-item-wrapper",
107
- css: elementItemWrapper
111
+ css: elementItemWrapper,
112
+ onKeyDown: (0, _platformFeatureFlags.getBooleanFF)('platform.editor.a11y-focus-order-for-element-browser-categories_ztiw1') ? function (e) {
113
+ if (e.key === 'Tab') {
114
+ if (e.shiftKey && index === 0) {
115
+ if (setFocusedCategoryIndex) {
116
+ if (!!selectedCategoryIndex) {
117
+ setFocusedCategoryIndex(selectedCategoryIndex);
118
+ } else {
119
+ setFocusedCategoryIndex(0);
120
+ }
121
+ e.preventDefault();
122
+ }
123
+ }
124
+ // before focus jumps from elements list we need to rerender react-virtualized collection.
125
+ // Otherwise on the next render 'scrollToCell' will have same cached value
126
+ // and collection will not be scrolled to top.
127
+ // So Tab press on category will not work anymore due to invisible 1-t element.
128
+ else if (index === items.length - 2) {
129
+ setFocusedItemIndex(items.length - 1);
130
+ }
131
+ }
132
+ } : undefined
108
133
  }, (0, _react2.jsx)(MemoizedElementItem, (0, _extends2.default)({
109
134
  inlineMode: !fullMode,
110
135
  index: index,
111
136
  item: items[index],
112
137
  selected: selectedItemIndex === index,
113
- focus: focusedItemIndex === index
138
+ focus: focusedItemIndex === index,
139
+ setFocusedItemIndex: setFocusedItemIndex
114
140
  }, props)));
115
141
  };
116
- }, [items, fullMode, selectedItemIndex, focusedItemIndex, props]);
142
+ }, [items, fullMode, selectedItemIndex, focusedItemIndex, selectedCategoryIndex, setFocusedCategoryIndex, setFocusedItemIndex, props]);
117
143
  return (0, _react2.jsx)(_react.Fragment, null, (0, _react2.jsx)(ContainerWidthMonitor, null), (0, _react2.jsx)("div", {
118
144
  css: elementItemsWrapper,
119
145
  "data-testid": "element-items",
@@ -12,6 +12,7 @@ var _react = _interopRequireWildcard(require("react"));
12
12
  var _react2 = require("@emotion/react");
13
13
  var _reactIntlNext = require("react-intl-next");
14
14
  var _analyticsNext = require("@atlaskit/analytics-next");
15
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
15
16
  var _analytics = require("../../analytics");
16
17
  var _constants = require("../constants");
17
18
  var _useContainerWidth2 = _interopRequireDefault(require("../hooks/use-container-width"));
@@ -101,18 +102,43 @@ function StatelessElementBrowser(props) {
101
102
  var items = props.items,
102
103
  onSelectItem = props.onSelectItem,
103
104
  onInsertItem = props.onInsertItem,
104
- viewMoreItem = props.viewMoreItem;
105
+ viewMoreItem = props.viewMoreItem,
106
+ selectedCategory = props.selectedCategory,
107
+ onSelectCategory = props.onSelectCategory,
108
+ searchTerm = props.searchTerm,
109
+ showCategories = props.showCategories;
105
110
  var _useContainerWidth = (0, _useContainerWidth2.default)(),
106
111
  containerWidth = _useContainerWidth.containerWidth,
107
112
  ContainerWidthMonitor = _useContainerWidth.ContainerWidthMonitor;
113
+ var categoryBeenChosen = (0, _react.useRef)(false);
108
114
  var _useState = (0, _react.useState)(1),
109
115
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
110
116
  columnCount = _useState2[0],
111
117
  setColumnCount = _useState2[1];
112
- var _useSelectAndFocusOnA = (0, _useSelectAndFocusOnArrowNavigation.default)(items.length - 1, columnCount, !!viewMoreItem),
118
+ var selectedCategoryIndex;
119
+ var isFocusSearch;
120
+ if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.a11y-focus-order-for-element-browser-categories_ztiw1')) {
121
+ var _props$categories;
122
+ selectedCategoryIndex = (_props$categories = props.categories) === null || _props$categories === void 0 ? void 0 : _props$categories.findIndex(function (category) {
123
+ return category.name === selectedCategory;
124
+ });
125
+ if (showCategories) {
126
+ var isEmptySearchTerm = !searchTerm || (searchTerm === null || searchTerm === void 0 ? void 0 : searchTerm.length) === 0;
127
+ if (!isEmptySearchTerm) {
128
+ // clear the flag if the search happens after a user has chosen the category
129
+ categoryBeenChosen.current = false;
130
+ }
131
+ // A11Y: if categories exists, on the initial render search element should receive focus.
132
+ // After user pick some category the category should stay focused.
133
+ isFocusSearch = !categoryBeenChosen.current || !isEmptySearchTerm;
134
+ }
135
+ }
136
+ var _useSelectAndFocusOnA = (0, _useSelectAndFocusOnArrowNavigation.default)(items.length - 1, columnCount, !!viewMoreItem, isFocusSearch),
113
137
  selectedItemIndex = _useSelectAndFocusOnA.selectedItemIndex,
114
138
  focusedItemIndex = _useSelectAndFocusOnA.focusedItemIndex,
115
139
  setFocusedItemIndex = _useSelectAndFocusOnA.setFocusedItemIndex,
140
+ setFocusedCategoryIndex = _useSelectAndFocusOnA.setFocusedCategoryIndex,
141
+ focusedCategoryIndex = _useSelectAndFocusOnA.focusedCategoryIndex,
116
142
  focusOnSearch = _useSelectAndFocusOnA.focusOnSearch,
117
143
  focusOnViewMore = _useSelectAndFocusOnA.focusOnViewMore,
118
144
  onKeyDown = _useSelectAndFocusOnA.onKeyDown,
@@ -146,15 +172,29 @@ function StatelessElementBrowser(props) {
146
172
  * The actual enter key press is handled on individual items level.
147
173
  */
148
174
  var selectedItem = selectedItemIndex !== undefined ? items[selectedItemIndex] : null;
149
- var onItemsEnterKeyPress = (0, _react.useCallback)(function (e) {
150
- if (e.key !== 'Enter') {
151
- return;
175
+ var onItemsEnterTabKeyPress = (0, _react.useCallback)(function (e) {
176
+ if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.a11y-focus-order-for-element-browser-categories_ztiw1')) {
177
+ if (e.key !== 'Enter' && (e.key !== 'Tab' || !showCategories)) {
178
+ return;
179
+ }
180
+ } else {
181
+ if (e.key !== 'Enter') {
182
+ return;
183
+ }
184
+ }
185
+ if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.a11y-focus-order-for-element-browser-categories_ztiw1')) {
186
+ if (showCategories && e.key === 'Tab' && selectedCategoryIndex !== undefined) {
187
+ // A11Y: Set focus on first category if tab pressed on search
188
+ setFocusedCategoryIndex(selectedCategoryIndex);
189
+ e.preventDefault();
190
+ return;
191
+ }
152
192
  }
153
193
  if (onInsertItem && selectedItem != null) {
154
194
  onInsertItem(selectedItem);
155
195
  }
156
196
  e.preventDefault();
157
- }, [onInsertItem, selectedItem]);
197
+ }, [onInsertItem, selectedItem, setFocusedCategoryIndex, showCategories, selectedCategoryIndex]);
158
198
 
159
199
  /**
160
200
  * On arrow key selection and clicks the selectedItemIndex will change.
@@ -165,6 +205,10 @@ function StatelessElementBrowser(props) {
165
205
  onSelectItem(selectedItem);
166
206
  }
167
207
  }, [onSelectItem, selectedItem]);
208
+ var onSelectCategoryCB = (0, _react.useCallback)(function (category) {
209
+ onSelectCategory(category);
210
+ categoryBeenChosen.current = true;
211
+ }, [categoryBeenChosen, onSelectCategory]);
168
212
  return (0, _react2.jsx)("div", {
169
213
  css: wrapper,
170
214
  "data-testid": "element-browser"
@@ -172,10 +216,12 @@ function StatelessElementBrowser(props) {
172
216
  selectedItemIndex: selectedItemIndex,
173
217
  focusedItemIndex: focusedItemIndex,
174
218
  setFocusedItemIndex: setFocusedItemIndex,
219
+ focusedCategoryIndex: focusedCategoryIndex,
220
+ setFocusedCategoryIndex: setFocusedCategoryIndex,
175
221
  focusOnSearch: focusOnSearch,
176
222
  setColumnCount: setColumnCount,
177
223
  setFocusOnSearch: setFocusOnSearch,
178
- onKeyPress: onItemsEnterKeyPress,
224
+ onKeyPress: onItemsEnterTabKeyPress,
179
225
  onKeyDown: onKeyDown,
180
226
  viewMoreItem: viewMoreItem,
181
227
  focusOnViewMore: focusOnViewMore
@@ -186,8 +232,12 @@ function StatelessElementBrowser(props) {
186
232
  focusOnSearch: focusOnSearch,
187
233
  setColumnCount: setColumnCount,
188
234
  setFocusOnSearch: setFocusOnSearch,
189
- onKeyPress: onItemsEnterKeyPress,
190
- onKeyDown: onKeyDown
235
+ onKeyPress: onItemsEnterTabKeyPress,
236
+ onKeyDown: onKeyDown,
237
+ focusedCategoryIndex: focusedCategoryIndex,
238
+ setFocusedCategoryIndex: setFocusedCategoryIndex,
239
+ selectedCategoryIndex: selectedCategoryIndex,
240
+ onSelectCategory: (0, _platformFeatureFlags.getBooleanFF)('platform.editor.a11y-focus-order-for-element-browser-categories_ztiw1') ? onSelectCategoryCB : onSelectCategory
191
241
  })));
192
242
  }
193
243
  function MobileBrowser(_ref) {
@@ -203,6 +253,8 @@ function MobileBrowser(_ref) {
203
253
  selectedItemIndex = _ref.selectedItemIndex,
204
254
  focusedItemIndex = _ref.focusedItemIndex,
205
255
  setFocusedItemIndex = _ref.setFocusedItemIndex,
256
+ focusedCategoryIndex = _ref.focusedCategoryIndex,
257
+ setFocusedCategoryIndex = _ref.setFocusedCategoryIndex,
206
258
  focusOnSearch = _ref.focusOnSearch,
207
259
  focusOnViewMore = _ref.focusOnViewMore,
208
260
  setColumnCount = _ref.setColumnCount,
@@ -234,7 +286,11 @@ function MobileBrowser(_ref) {
234
286
  }, (0, _react2.jsx)(_CategoryList.default, {
235
287
  categories: categories,
236
288
  onSelectCategory: onSelectCategory,
237
- selectedCategory: selectedCategory
289
+ selectedCategory: selectedCategory,
290
+ focusedCategoryIndex: focusedCategoryIndex,
291
+ setFocusedCategoryIndex: setFocusedCategoryIndex,
292
+ setFocusedItemIndex: setFocusedItemIndex,
293
+ setFocusOnSearch: setFocusOnSearch
238
294
  }))), (0, _react2.jsx)("div", {
239
295
  css: mobileMainContent
240
296
  }, (0, _react2.jsx)(_ElementList.default, {
@@ -267,6 +323,9 @@ function DesktopBrowser(_ref2) {
267
323
  selectedItemIndex = _ref2.selectedItemIndex,
268
324
  focusedItemIndex = _ref2.focusedItemIndex,
269
325
  setFocusedItemIndex = _ref2.setFocusedItemIndex,
326
+ focusedCategoryIndex = _ref2.focusedCategoryIndex,
327
+ setFocusedCategoryIndex = _ref2.setFocusedCategoryIndex,
328
+ selectedCategoryIndex = _ref2.selectedCategoryIndex,
270
329
  focusOnSearch = _ref2.focusOnSearch,
271
330
  setColumnCount = _ref2.setColumnCount,
272
331
  setFocusOnSearch = _ref2.setFocusOnSearch,
@@ -296,7 +355,11 @@ function DesktopBrowser(_ref2) {
296
355
  categories: categories,
297
356
  onSelectCategory: onSelectCategory,
298
357
  selectedCategory: selectedCategory,
299
- createAnalyticsEvent: createAnalyticsEvent
358
+ createAnalyticsEvent: createAnalyticsEvent,
359
+ focusedCategoryIndex: focusedCategoryIndex,
360
+ setFocusedCategoryIndex: setFocusedCategoryIndex,
361
+ setFocusedItemIndex: setFocusedItemIndex,
362
+ setFocusOnSearch: setFocusOnSearch
300
363
  }))), (0, _react2.jsx)("div", {
301
364
  css: mainContent,
302
365
  onKeyDown: onKeyDown,
@@ -325,7 +388,9 @@ function DesktopBrowser(_ref2) {
325
388
  createAnalyticsEvent: createAnalyticsEvent,
326
389
  emptyStateHandler: emptyStateHandler,
327
390
  selectedCategory: selectedCategory,
328
- searchTerm: searchTerm
391
+ selectedCategoryIndex: selectedCategoryIndex,
392
+ searchTerm: searchTerm,
393
+ setFocusedCategoryIndex: showCategories ? setFocusedCategoryIndex : undefined
329
394
  })));
330
395
  }
331
396
  var MemoizedElementBrowser = /*#__PURE__*/(0, _react.memo)((0, _analyticsNext.withAnalyticsContext)({
@@ -8,6 +8,7 @@ exports.ensureSafeIndex = exports.default = exports.ACTIONS = void 0;
8
8
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
9
9
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
10
10
  var _react = require("react");
11
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
11
12
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
12
13
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
13
14
  /**
@@ -62,6 +63,7 @@ var reducer = function reducer(state, action) {
62
63
  case ACTIONS.FOCUS_SEARCH:
63
64
  return _objectSpread(_objectSpread({}, state), {}, {
64
65
  focusedItemIndex: undefined,
66
+ focusedCategoryIndex: undefined,
65
67
  focusOnSearch: true,
66
68
  focusOnViewMore: false
67
69
  });
@@ -171,7 +173,7 @@ var getInitialState = function getInitialState(listSize, canFocusViewMore) {
171
173
  });
172
174
  };
173
175
  };
174
- function useSelectAndFocusOnArrowNavigation(listSize, step, canFocusViewMore) {
176
+ function useSelectAndFocusOnArrowNavigation(listSize, step, canFocusViewMore, isFocusSearch) {
175
177
  var _useReducer = (0, _react.useReducer)(reducer, initialState, getInitialState(listSize, canFocusViewMore)),
176
178
  _useReducer2 = (0, _slicedToArray2.default)(_useReducer, 2),
177
179
  state = _useReducer2[0],
@@ -187,16 +189,26 @@ function useSelectAndFocusOnArrowNavigation(listSize, step, canFocusViewMore) {
187
189
  var selectedItemIndex = state.selectedItemIndex,
188
190
  focusedItemIndex = state.focusedItemIndex,
189
191
  focusOnSearch = state.focusOnSearch,
190
- focusOnViewMore = state.focusOnViewMore;
192
+ focusOnViewMore = state.focusOnViewMore,
193
+ focusedCategoryIndex = state.focusedCategoryIndex;
194
+
195
+ // calls if items size changed
191
196
  var reset = (0, _react.useCallback)(function (listSize) {
192
197
  var payload = _objectSpread(_objectSpread({}, initialState), {}, {
193
198
  listSize: listSize
194
199
  });
200
+ if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.a11y-focus-order-for-element-browser-categories_ztiw1')) {
201
+ // A11Y: if categories exist ,on the initial render search element should receive focus.
202
+ // After user pick some category the category should stay focused.
203
+ payload = Object.assign(payload, {
204
+ focusOnSearch: isFocusSearch !== null && isFocusSearch !== void 0 ? isFocusSearch : initialState.focusOnSearch
205
+ });
206
+ }
195
207
  dispatch({
196
208
  type: ACTIONS.UPDATE_STATE,
197
209
  payload: payload
198
210
  });
199
- }, []);
211
+ }, [isFocusSearch]);
200
212
  var removeFocusFromSearchAndSetOnItem = (0, _react.useCallback)(function (index) {
201
213
  var payload = {
202
214
  focusedItemIndex: index,
@@ -204,6 +216,26 @@ function useSelectAndFocusOnArrowNavigation(listSize, step, canFocusViewMore) {
204
216
  focusOnSearch: false,
205
217
  focusOnViewMore: false
206
218
  };
219
+ if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.a11y-focus-order-for-element-browser-categories_ztiw1')) {
220
+ payload = Object.assign(payload, {
221
+ focusedCategoryIndex: undefined
222
+ });
223
+ }
224
+ dispatch({
225
+ type: ACTIONS.UPDATE_STATE,
226
+ payload: payload
227
+ });
228
+ }, [dispatch]);
229
+ var setFocusedCategoryIndex = (0, _react.useCallback)(function (index) {
230
+ if (!(0, _platformFeatureFlags.getBooleanFF)('platform.editor.a11y-focus-order-for-element-browser-categories_ztiw1')) {
231
+ return;
232
+ }
233
+ var payload = {
234
+ focusOnSearch: false,
235
+ focusOnViewMore: false,
236
+ focusedCategoryIndex: index,
237
+ focusedItemIndex: undefined
238
+ };
207
239
  dispatch({
208
240
  type: ACTIONS.UPDATE_STATE,
209
241
  payload: payload
@@ -268,7 +300,9 @@ function useSelectAndFocusOnArrowNavigation(listSize, step, canFocusViewMore) {
268
300
  focusOnViewMore: focusOnViewMore,
269
301
  setFocusOnSearch: setFocusOnSearch,
270
302
  focusedItemIndex: focusedItemIndex,
271
- setFocusedItemIndex: removeFocusFromSearchAndSetOnItem
303
+ setFocusedItemIndex: removeFocusFromSearchAndSetOnItem,
304
+ focusedCategoryIndex: focusedCategoryIndex,
305
+ setFocusedCategoryIndex: setFocusedCategoryIndex
272
306
  };
273
307
  }
274
308
  var ensureSafeIndex = exports.ensureSafeIndex = function ensureSafeIndex(index, listSize) {
@@ -203,12 +203,17 @@ var toolbarInsertBlockMessages = exports.toolbarInsertBlockMessages = (0, _react
203
203
  },
204
204
  addLoomVideo: {
205
205
  id: 'fabric.editor.addLoomVideo',
206
- defaultMessage: 'Add Loom Video',
207
- description: 'Record a new Loom video'
206
+ defaultMessage: 'Record a Loom video',
207
+ description: 'Record a Loom video'
208
+ },
209
+ addLoomVideoComment: {
210
+ id: 'fabric.editor.addLoomVideoComment',
211
+ defaultMessage: 'Record a Loom video comment',
212
+ description: 'Record a Loom video comment'
208
213
  },
209
214
  recordVideoDescription: {
210
215
  id: 'fabric.editor.recordVideo.description',
211
- defaultMessage: 'Record your screen and camera',
212
- description: 'Record your screen and camera'
216
+ defaultMessage: 'Record and share your screen and thoughts',
217
+ description: 'Record and share your screen and thoughts'
213
218
  }
214
219
  });
@@ -16,7 +16,7 @@ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return
16
16
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
17
17
  var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
18
18
  var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
19
- var packageVersion = "78.37.0";
19
+ var packageVersion = "78.37.2";
20
20
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
21
21
  // Remove URL as it has UGC
22
22
  // TODO: Sanitise the URL instead of just removing it
@@ -135,6 +135,12 @@ Object.defineProperty(exports, "annotationSharedStyles", {
135
135
  return _annotation.annotationSharedStyles;
136
136
  }
137
137
  });
138
+ Object.defineProperty(exports, "backgroundColorStyles", {
139
+ enumerable: true,
140
+ get: function get() {
141
+ return _backgroundColor.backgroundColorStyles;
142
+ }
143
+ });
138
144
  Object.defineProperty(exports, "blockMarksSharedStyles", {
139
145
  enumerable: true,
140
146
  get: function get() {
@@ -424,6 +430,7 @@ Object.defineProperty(exports, "wrapperStyle", {
424
430
  }
425
431
  });
426
432
  var _textColor = require("./shared/text-color");
433
+ var _backgroundColor = require("./shared/background-color");
427
434
  var _table = require("./shared/table");
428
435
  var _annotation = require("./shared/annotation");
429
436
  var _columnLayout = require("./shared/column-layout");
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.backgroundColorStyles = void 0;
7
+ var _react = require("@emotion/react");
8
+ var backgroundColorStyles = exports.backgroundColorStyles = (0, _react.css)({
9
+ '.fabric-background-color-mark': {
10
+ backgroundColor: 'var(--custom-palette-color, inherit)'
11
+ },
12
+ 'a .fabric-background-color-mark': {
13
+ backgroundColor: 'unset'
14
+ }
15
+ });
@@ -20,7 +20,7 @@ var _Layer = _interopRequireDefault(require("../Layer"));
20
20
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
21
21
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } /** @jsx jsx */
22
22
  var packageName = "@atlaskit/editor-common";
23
- var packageVersion = "78.37.0";
23
+ var packageVersion = "78.37.2";
24
24
  var halfFocusRing = 1;
25
25
  var dropOffset = '0, 8';
26
26
  var DropList = /*#__PURE__*/function (_Component) {
@@ -13,7 +13,8 @@ var separator = (0, _react.css)({
13
13
  width: '1px',
14
14
  height: '20px',
15
15
  margin: "0 ".concat("var(--ds-space-050, 4px)"),
16
- alignSelf: 'center'
16
+ alignSelf: 'center',
17
+ pointerEvents: 'none'
17
18
  });
18
19
  var _default = exports.default = function _default() {
19
20
  return (0, _react.jsx)("div", {