@atlaskit/editor-plugin-table 7.18.2 → 7.18.4

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 (75) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/cjs/commands/column-resize.js +0 -12
  3. package/dist/cjs/commands/go-to-next-cell.js +8 -11
  4. package/dist/cjs/commands/index.js +6 -0
  5. package/dist/cjs/commands/misc.js +15 -1
  6. package/dist/cjs/commands/selection.js +4 -11
  7. package/dist/cjs/event-handlers.js +7 -11
  8. package/dist/cjs/plugin.js +7 -4
  9. package/dist/cjs/pm-plugins/keymap.js +22 -21
  10. package/dist/cjs/pm-plugins/main.js +26 -30
  11. package/dist/cjs/pm-plugins/table-resizing/event-handlers.js +13 -21
  12. package/dist/cjs/pm-plugins/table-resizing/plugin.js +8 -11
  13. package/dist/cjs/reducer.js +1 -0
  14. package/dist/cjs/ui/FloatingContextualButton/index.js +18 -2
  15. package/dist/cjs/ui/FloatingContextualMenu/ContextualMenu.js +170 -35
  16. package/dist/cjs/ui/FloatingContextualMenu/index.js +4 -2
  17. package/dist/es2019/commands/column-resize.js +0 -12
  18. package/dist/es2019/commands/go-to-next-cell.js +8 -11
  19. package/dist/es2019/commands/index.js +1 -1
  20. package/dist/es2019/commands/misc.js +9 -1
  21. package/dist/es2019/commands/selection.js +4 -11
  22. package/dist/es2019/event-handlers.js +8 -12
  23. package/dist/es2019/plugin.js +7 -4
  24. package/dist/es2019/pm-plugins/keymap.js +24 -23
  25. package/dist/es2019/pm-plugins/main.js +27 -31
  26. package/dist/es2019/pm-plugins/table-resizing/event-handlers.js +13 -21
  27. package/dist/es2019/pm-plugins/table-resizing/plugin.js +9 -12
  28. package/dist/es2019/reducer.js +1 -0
  29. package/dist/es2019/ui/FloatingContextualButton/index.js +17 -2
  30. package/dist/es2019/ui/FloatingContextualMenu/ContextualMenu.js +159 -24
  31. package/dist/es2019/ui/FloatingContextualMenu/index.js +4 -2
  32. package/dist/esm/commands/column-resize.js +0 -12
  33. package/dist/esm/commands/go-to-next-cell.js +8 -11
  34. package/dist/esm/commands/index.js +1 -1
  35. package/dist/esm/commands/misc.js +14 -0
  36. package/dist/esm/commands/selection.js +4 -11
  37. package/dist/esm/event-handlers.js +7 -11
  38. package/dist/esm/plugin.js +7 -4
  39. package/dist/esm/pm-plugins/keymap.js +24 -23
  40. package/dist/esm/pm-plugins/main.js +26 -30
  41. package/dist/esm/pm-plugins/table-resizing/event-handlers.js +13 -21
  42. package/dist/esm/pm-plugins/table-resizing/plugin.js +8 -11
  43. package/dist/esm/reducer.js +1 -0
  44. package/dist/esm/ui/FloatingContextualButton/index.js +15 -2
  45. package/dist/esm/ui/FloatingContextualMenu/ContextualMenu.js +171 -40
  46. package/dist/esm/ui/FloatingContextualMenu/index.js +4 -2
  47. package/dist/types/commands/index.d.ts +1 -1
  48. package/dist/types/commands/misc.d.ts +1 -0
  49. package/dist/types/types.d.ts +6 -0
  50. package/dist/types/ui/FloatingContextualButton/index.d.ts +1 -0
  51. package/dist/types/ui/FloatingContextualMenu/ContextualMenu.d.ts +7 -3
  52. package/dist/types/ui/FloatingContextualMenu/index.d.ts +2 -1
  53. package/dist/types-ts4.5/commands/index.d.ts +1 -1
  54. package/dist/types-ts4.5/commands/misc.d.ts +1 -0
  55. package/dist/types-ts4.5/types.d.ts +6 -0
  56. package/dist/types-ts4.5/ui/FloatingContextualButton/index.d.ts +1 -0
  57. package/dist/types-ts4.5/ui/FloatingContextualMenu/ContextualMenu.d.ts +7 -3
  58. package/dist/types-ts4.5/ui/FloatingContextualMenu/index.d.ts +2 -1
  59. package/package.json +4 -4
  60. package/src/commands/column-resize.ts +0 -14
  61. package/src/commands/go-to-next-cell.ts +7 -10
  62. package/src/commands/index.ts +1 -0
  63. package/src/commands/misc.ts +13 -0
  64. package/src/commands/selection.ts +4 -11
  65. package/src/event-handlers.ts +6 -12
  66. package/src/plugin.tsx +6 -1
  67. package/src/pm-plugins/keymap.ts +65 -62
  68. package/src/pm-plugins/main.ts +27 -31
  69. package/src/pm-plugins/table-resizing/event-handlers.ts +11 -19
  70. package/src/pm-plugins/table-resizing/plugin.ts +7 -10
  71. package/src/reducer.ts +1 -0
  72. package/src/types.ts +8 -1
  73. package/src/ui/FloatingContextualButton/index.tsx +19 -1
  74. package/src/ui/FloatingContextualMenu/ContextualMenu.tsx +207 -30
  75. package/src/ui/FloatingContextualMenu/index.tsx +3 -0
@@ -8,7 +8,6 @@ import { findParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
8
8
  import { TableMap } from '@atlaskit/editor-tables/table-map';
9
9
  import type { Direction } from '@atlaskit/editor-tables/types';
10
10
  import { goToNextCell as baseGotoNextCell, findTable } from '@atlaskit/editor-tables/utils';
11
- import { getBooleanFF } from '@atlaskit/platform-feature-flags';
12
11
 
13
12
  import { insertRowWithAnalytics } from '../commands-with-analytics';
14
13
  import { getPluginState } from '../pm-plugins/plugin-factory';
@@ -31,15 +30,13 @@ export const goToNextCell =
31
30
  return false;
32
31
  }
33
32
 
34
- if (getBooleanFF('platform.editor.a11y-column-resizing_emcvz')) {
35
- const isColumnResizing = getPluginState(state)?.isKeyboardResize;
36
- if (isColumnResizing) {
37
- stopKeyboardColumnResizing({
38
- ariaNotify: ariaNotify,
39
- getIntl: getIntl,
40
- })(state, dispatch, view);
41
- return true;
42
- }
33
+ const isColumnResizing = getPluginState(state)?.isKeyboardResize;
34
+ if (isColumnResizing) {
35
+ stopKeyboardColumnResizing({
36
+ ariaNotify: ariaNotify,
37
+ getIntl: getIntl,
38
+ })(state, dispatch, view);
39
+ return true;
43
40
  }
44
41
 
45
42
  const map = TableMap.get(table.node);
@@ -40,6 +40,7 @@ export {
40
40
  addBoldInEmptyHeaderCells,
41
41
  addResizeHandleDecorations,
42
42
  updateWidthToWidest,
43
+ setFocusToCellMenu,
43
44
  } from './misc';
44
45
  export { sortByColumn } from './sort';
45
46
  export { goToNextCell } from './go-to-next-cell';
@@ -773,3 +773,16 @@ export const setTableAlignmentWithTableContentWithPos =
773
773
 
774
774
  return tr;
775
775
  };
776
+
777
+ export const setFocusToCellMenu = (isCellMenuOpenByKeyboard = true, originalTr?: Transaction) =>
778
+ createCommand(
779
+ () => {
780
+ return {
781
+ type: 'SET_CELL_MENU_OPEN',
782
+ data: {
783
+ isCellMenuOpenByKeyboard: isCellMenuOpenByKeyboard,
784
+ },
785
+ };
786
+ },
787
+ (tr) => (originalTr || tr).setMeta('addToHistory', false),
788
+ );
@@ -18,7 +18,6 @@ import {
18
18
  isTableSelected,
19
19
  selectedRect,
20
20
  } from '@atlaskit/editor-tables/utils';
21
- import { getBooleanFF } from '@atlaskit/platform-feature-flags';
22
21
 
23
22
  import { selectColumn, selectRow } from '../commands/misc';
24
23
  import type tablePlugin from '../plugin';
@@ -219,12 +218,9 @@ const arrowLeftFromText =
219
218
  const table = findTable(selection);
220
219
  if (table) {
221
220
  const { $from } = selection;
222
- let isColumnResizing = false;
223
221
 
224
- if (getBooleanFF('platform.editor.a11y-column-resizing_emcvz')) {
225
- const columResizePluginState = getPluginState(state) || {};
226
- isColumnResizing = Boolean(columResizePluginState?.isKeyboardResize);
227
- }
222
+ const columResizePluginState = getPluginState(state) || {};
223
+ const isColumnResizing = Boolean(columResizePluginState?.isKeyboardResize);
228
224
 
229
225
  if (
230
226
  isSelectionAtStartOfTable($from, selection) &&
@@ -261,12 +257,9 @@ const arrowRightFromText =
261
257
  const table = findTable(selection);
262
258
  if (table) {
263
259
  const { $to } = selection;
264
- let isColumnResizing = false;
265
260
 
266
- if (getBooleanFF('platform.editor.a11y-column-resizing_emcvz')) {
267
- const columResizePluginState = getPluginState(state) || {};
268
- isColumnResizing = Boolean(columResizePluginState?.isKeyboardResize);
269
- }
261
+ const columResizePluginState = getPluginState(state) || {};
262
+ const isColumnResizing = Boolean(columResizePluginState?.isKeyboardResize);
270
263
  if (
271
264
  isSelectionAtEndOfTable($to, selection) &&
272
265
  $to.parent.type.name === 'paragraph' &&
@@ -286,16 +286,12 @@ export const handleMouseOut = (view: EditorView, mouseEvent: Event): boolean =>
286
286
  // we don't need to hide the resize handle decoration
287
287
  if (isResizeHandleDecoration(target) && !isResizeHandleDecoration(relatedTarget)) {
288
288
  const { state, dispatch } = view;
289
- if (getBooleanFF('platform.editor.a11y-column-resizing_emcvz')) {
290
- const { isKeyboardResize } = getPluginState(state);
291
- if (isKeyboardResize) {
292
- // no need to hide decoration if column resizing started by keyboard
293
- return false;
294
- }
295
- return hideResizeHandleLine()(state, dispatch);
296
- } else {
297
- return hideResizeHandleLine()(state, dispatch);
289
+ const { isKeyboardResize } = getPluginState(state);
290
+ if (isKeyboardResize) {
291
+ // no need to hide decoration if column resizing started by keyboard
292
+ return false;
298
293
  }
294
+ return hideResizeHandleLine()(state, dispatch);
299
295
  }
300
296
 
301
297
  return false;
@@ -401,9 +397,7 @@ const handleMouseMoveDebounce = rafSchedule(
401
397
  const { state, dispatch } = view;
402
398
  const { resizeHandleColumnIndex, resizeHandleRowIndex } = getPluginState(state);
403
399
 
404
- const isKeyboardResize = getBooleanFF('platform.editor.a11y-column-resizing_emcvz')
405
- ? getPluginState(state).isKeyboardResize
406
- : false;
400
+ const isKeyboardResize = getPluginState(state).isKeyboardResize;
407
401
  const tableCell = closestElement(element, 'td, th') as HTMLTableCellElement;
408
402
  const cellStartPosition = view.posAtDOM(tableCell, 0);
409
403
  const rect = findCellRectClosestToPos(state.doc.resolve(cellStartPosition));
package/src/plugin.tsx CHANGED
@@ -514,6 +514,7 @@ const tablesPlugin: TablePlugin = ({ config: options, api }) => {
514
514
  isHeaderRowEnabled,
515
515
  isDragAndDropEnabled,
516
516
  tableWrapperTarget,
517
+ isCellMenuOpenByKeyboard,
517
518
  } = tablePluginState!;
518
519
 
519
520
  const { allowControls } = pluginConfig;
@@ -525,7 +526,9 @@ const tablesPlugin: TablePlugin = ({ config: options, api }) => {
525
526
  return (
526
527
  <>
527
528
  {targetCellPosition &&
528
- tableRef &&
529
+ (tableRef ||
530
+ (getBooleanFF('platform.editor.a11y-table-context-menu_y4c9c') &&
531
+ isCellMenuOpenByKeyboard)) &&
529
532
  !isResizing &&
530
533
  options &&
531
534
  options.allowContextualMenu && (
@@ -540,6 +543,7 @@ const tablesPlugin: TablePlugin = ({ config: options, api }) => {
540
543
  isContextualMenuOpen={isContextualMenuOpen}
541
544
  stickyHeader={stickyHeader}
542
545
  tableWrapper={tableWrapperTarget}
546
+ isCellMenuOpenByKeyboard={isCellMenuOpenByKeyboard}
543
547
  />
544
548
  )}
545
549
  {allowControls && (
@@ -578,6 +582,7 @@ const tablesPlugin: TablePlugin = ({ config: options, api }) => {
578
582
  getEditorFeatureFlags={
579
583
  options?.getEditorFeatureFlags || defaultGetEditorFeatureFlags
580
584
  }
585
+ isCellMenuOpenByKeyboard={isCellMenuOpenByKeyboard}
581
586
  />
582
587
  )}
583
588
  {isDragAndDropEnabled && (
@@ -17,6 +17,7 @@ import {
17
17
  deleteColumn,
18
18
  deleteRow,
19
19
  escape,
20
+ focusToContextMenuTrigger,
20
21
  increaseMediaSize,
21
22
  moveColumnLeft,
22
23
  moveColumnRight,
@@ -35,7 +36,7 @@ import { chainCommands } from '@atlaskit/editor-prosemirror/commands';
35
36
  import { keymap } from '@atlaskit/editor-prosemirror/keymap';
36
37
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
37
38
 
38
- import { goToNextCell, moveCursorBackward } from '../commands';
39
+ import { goToNextCell, moveCursorBackward, setFocusToCellMenu } from '../commands';
39
40
  import {
40
41
  addRowAroundSelection,
41
42
  changeColumnWidthByStepWithAnalytics,
@@ -231,71 +232,73 @@ export function keymapPlugin(
231
232
  );
232
233
  }
233
234
 
234
- if (getBooleanFF('platform.editor.a11y-column-resizing_emcvz')) {
235
- bindKeymapWithCommand(
236
- startColumnResizing.common!,
237
- initiateKeyboardColumnResizing({
238
- ariaNotify: ariaNotifyPlugin,
239
- getIntl: getIntl,
240
- }),
241
- list,
242
- );
235
+ bindKeymapWithCommand(
236
+ startColumnResizing.common!,
237
+ initiateKeyboardColumnResizing({
238
+ ariaNotify: ariaNotifyPlugin,
239
+ getIntl: getIntl,
240
+ }),
241
+ list,
242
+ );
243
243
 
244
- bindKeymapWithCommand(
245
- moveRight.common!,
246
- activateNextResizeArea({
247
- direction: 1,
248
- ariaNotify: ariaNotifyPlugin,
249
- getIntl: getIntl,
250
- }),
251
- list,
252
- );
244
+ bindKeymapWithCommand(
245
+ moveRight.common!,
246
+ activateNextResizeArea({
247
+ direction: 1,
248
+ ariaNotify: ariaNotifyPlugin,
249
+ getIntl: getIntl,
250
+ }),
251
+ list,
252
+ );
253
253
 
254
- bindKeymapWithCommand(
255
- moveLeft.common!,
256
- activateNextResizeArea({
257
- direction: -1,
258
- ariaNotify: ariaNotifyPlugin,
259
- getIntl: getIntl,
260
- }),
261
- list,
262
- );
254
+ bindKeymapWithCommand(
255
+ moveLeft.common!,
256
+ activateNextResizeArea({
257
+ direction: -1,
258
+ ariaNotify: ariaNotifyPlugin,
259
+ getIntl: getIntl,
260
+ }),
261
+ list,
262
+ );
263
263
 
264
- bindKeymapWithCommand(
265
- decreaseMediaSize.common!,
266
- changeColumnWidthByStepWithAnalytics(editorAnalyticsAPI)(
267
- -10,
268
- getEditorContainerWidth,
269
- isTableScalingEnabled,
270
- isTableFixedColumnWidthsOptionEnabled,
271
- INPUT_METHOD.SHORTCUT,
272
- ariaNotifyPlugin,
273
- getIntl,
274
- ),
275
- list,
276
- );
264
+ bindKeymapWithCommand(
265
+ decreaseMediaSize.common!,
266
+ changeColumnWidthByStepWithAnalytics(editorAnalyticsAPI)(
267
+ -10,
268
+ getEditorContainerWidth,
269
+ isTableScalingEnabled,
270
+ isTableFixedColumnWidthsOptionEnabled,
271
+ INPUT_METHOD.SHORTCUT,
272
+ ariaNotifyPlugin,
273
+ getIntl,
274
+ ),
275
+ list,
276
+ );
277
277
 
278
- bindKeymapWithCommand(
279
- increaseMediaSize.common!,
280
- changeColumnWidthByStepWithAnalytics(editorAnalyticsAPI)(
281
- 10,
282
- getEditorContainerWidth,
283
- isTableScalingEnabled,
284
- isTableFixedColumnWidthsOptionEnabled,
285
- INPUT_METHOD.SHORTCUT,
286
- ariaNotifyPlugin,
287
- getIntl,
288
- ),
289
- list,
290
- );
291
- bindKeymapWithCommand(
292
- escape.common!,
293
- stopKeyboardColumnResizing({
294
- ariaNotify: ariaNotifyPlugin,
295
- getIntl: getIntl,
296
- }),
297
- list,
298
- );
278
+ bindKeymapWithCommand(
279
+ increaseMediaSize.common!,
280
+ changeColumnWidthByStepWithAnalytics(editorAnalyticsAPI)(
281
+ 10,
282
+ getEditorContainerWidth,
283
+ isTableScalingEnabled,
284
+ isTableFixedColumnWidthsOptionEnabled,
285
+ INPUT_METHOD.SHORTCUT,
286
+ ariaNotifyPlugin,
287
+ getIntl,
288
+ ),
289
+ list,
290
+ );
291
+ bindKeymapWithCommand(
292
+ escape.common!,
293
+ stopKeyboardColumnResizing({
294
+ ariaNotify: ariaNotifyPlugin,
295
+ getIntl: getIntl,
296
+ }),
297
+ list,
298
+ );
299
+
300
+ if (getBooleanFF('platform.editor.a11y-table-context-menu_y4c9c')) {
301
+ bindKeymapWithCommand(focusToContextMenuTrigger.common!, setFocusToCellMenu(), list);
299
302
  }
300
303
 
301
304
  return keymap(list) as SafePlugin;
@@ -193,33 +193,31 @@ export const createPlugin = (
193
193
  (parent as HTMLElement).querySelector<HTMLTableElement>('table') || undefined;
194
194
  }
195
195
  const tableNode = findTable(state.selection);
196
- if (getBooleanFF('platform.editor.a11y-column-resizing_emcvz')) {
197
- // when keyboard cursor leaves the table we need to stop column resizing
198
- const pluginPrevState = getPluginState(prevState);
199
- const isStopKeyboardColumResizing =
200
- pluginPrevState.isResizeHandleWidgetAdded && pluginPrevState.isKeyboardResize;
201
- if (isStopKeyboardColumResizing) {
202
- const isTableNodesDifferent = pluginPrevState?.tableNode !== tableNode?.node;
203
- if (pluginPrevState?.tableNode && tableNode && isTableNodesDifferent) {
204
- const oldRowsNumber = TableMap.get(pluginPrevState.tableNode).height;
205
- const newRowsNumber = TableMap.get(tableNode.node).height;
206
- if (
207
- oldRowsNumber !== newRowsNumber || // Add/delete row
208
- tableNode.node.attrs.localId !== pluginPrevState.tableNode.attrs.localId
209
- ) {
210
- // Jump to another table
211
- stopKeyboardColumnResizing({
212
- ariaNotify: ariaNotifyPlugin,
213
- getIntl: getIntl,
214
- })(state, dispatch);
215
- }
216
- } else if (!tableNode) {
217
- // selection outside of table
196
+ // when keyboard cursor leaves the table we need to stop column resizing
197
+ const pluginPrevState = getPluginState(prevState);
198
+ const isStopKeyboardColumResizing =
199
+ pluginPrevState.isResizeHandleWidgetAdded && pluginPrevState.isKeyboardResize;
200
+ if (isStopKeyboardColumResizing) {
201
+ const isTableNodesDifferent = pluginPrevState?.tableNode !== tableNode?.node;
202
+ if (pluginPrevState?.tableNode && tableNode && isTableNodesDifferent) {
203
+ const oldRowsNumber = TableMap.get(pluginPrevState.tableNode).height;
204
+ const newRowsNumber = TableMap.get(tableNode.node).height;
205
+ if (
206
+ oldRowsNumber !== newRowsNumber || // Add/delete row
207
+ tableNode.node.attrs.localId !== pluginPrevState.tableNode.attrs.localId
208
+ ) {
209
+ // Jump to another table
218
210
  stopKeyboardColumnResizing({
219
211
  ariaNotify: ariaNotifyPlugin,
220
212
  getIntl: getIntl,
221
213
  })(state, dispatch);
222
214
  }
215
+ } else if (!tableNode) {
216
+ // selection outside of table
217
+ stopKeyboardColumnResizing({
218
+ ariaNotify: ariaNotifyPlugin,
219
+ getIntl: getIntl,
220
+ })(state, dispatch);
223
221
  }
224
222
  }
225
223
  }
@@ -337,15 +335,13 @@ export const createPlugin = (
337
335
  },
338
336
  handleTextInput: (view, _from, _to, text) => {
339
337
  const { state, dispatch } = view;
340
- if (getBooleanFF('platform.editor.a11y-column-resizing_emcvz')) {
341
- const { isKeyboardResize } = getPluginState(state);
342
- if (isKeyboardResize) {
343
- stopKeyboardColumnResizing({
344
- ariaNotify: ariaNotifyPlugin,
345
- getIntl: getIntl,
346
- })(state, dispatch);
347
- return false;
348
- }
338
+ const { isKeyboardResize } = getPluginState(state);
339
+ if (isKeyboardResize) {
340
+ stopKeyboardColumnResizing({
341
+ ariaNotify: ariaNotifyPlugin,
342
+ getIntl: getIntl,
343
+ })(state, dispatch);
344
+ return false;
349
345
  }
350
346
  const tr = replaceSelectedTable(state, text, INPUT_METHOD.KEYBOARD, editorAnalyticsAPI);
351
347
  if (tr.selectionSet) {
@@ -152,15 +152,11 @@ export const handleMouseDown = (
152
152
 
153
153
  // If we let go in the same place we started, don't need to do anything.
154
154
  if (dragging && clientX === dragging.startX) {
155
- if (getBooleanFF('platform.editor.a11y-column-resizing_emcvz')) {
156
- if (isKeyboardResize || !isTableHovered) {
157
- /** if column resize had started via keyboard but continued by mouse
158
- * or mouse pointer leaves the table but mouse button still pressed
159
- */
160
- return stopKeyboardColumnResizing({})(state, dispatch, view);
161
- } else {
162
- return stopResizing()(state, dispatch);
163
- }
155
+ if (isKeyboardResize || !isTableHovered) {
156
+ /** if column resize had started via keyboard but continued by mouse
157
+ * or mouse pointer leaves the table but mouse button still pressed
158
+ */
159
+ return stopKeyboardColumnResizing({})(state, dispatch, view);
164
160
  } else {
165
161
  return stopResizing()(state, dispatch);
166
162
  }
@@ -255,15 +251,11 @@ export const handleMouseDown = (
255
251
  },
256
252
  })(tr);
257
253
  }
258
- if (getBooleanFF('platform.editor.a11y-column-resizing_emcvz')) {
259
- if (isKeyboardResize || !isTableHovered) {
260
- /** if column resize had started via keyboard but continued by mouse
261
- * or mouse pointer leaves the table but mouse button still pressed
262
- */
263
- return stopKeyboardColumnResizing({ originalTr: tr })(state, dispatch, view);
264
- } else {
265
- return stopResizing(tr)(state, dispatch);
266
- }
254
+ if (isKeyboardResize || !isTableHovered) {
255
+ /** if column resize had started via keyboard but continued by mouse
256
+ * or mouse pointer leaves the table but mouse button still pressed
257
+ */
258
+ return stopKeyboardColumnResizing({ originalTr: tr })(state, dispatch, view);
267
259
  } else {
268
260
  return stopResizing(tr)(state, dispatch);
269
261
  }
@@ -280,7 +272,7 @@ export const handleMouseDown = (
280
272
  !dragging ||
281
273
  resizeHandlePos === null ||
282
274
  !pointsAtCell(state.doc.resolve(resizeHandlePos)) ||
283
- (!isTableHovered && getBooleanFF('platform.editor.a11y-column-resizing_emcvz'))
275
+ !isTableHovered
284
276
  ) {
285
277
  return finish(event);
286
278
  }
@@ -4,7 +4,6 @@ import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
4
4
  import type { Dispatch } from '@atlaskit/editor-common/event-dispatcher';
5
5
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
6
6
  import type { GetEditorContainerWidth, GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
7
- import { getBooleanFF } from '@atlaskit/platform-feature-flags';
8
7
 
9
8
  import { TableCssClassName as ClassName } from '../../types';
10
9
  import type { ColumnResizingPluginState } from '../../types';
@@ -55,15 +54,13 @@ export function createPlugin(
55
54
 
56
55
  const { dragging } = getPluginState(state);
57
56
  let isColumnKeyboardResizeStarted = false;
58
- if (getBooleanFF('platform.editor.a11y-column-resizing_emcvz')) {
59
- /*
60
- We need to start listening mouse events if column resize started from keyboard.
61
- This will allow continue resizing via mouse
62
- */
63
- const { isKeyboardResize } = getTablePluginState(state);
64
- if (isKeyboardResize) {
65
- isColumnKeyboardResizeStarted = isKeyboardResize;
66
- }
57
+ /*
58
+ We need to start listening mouse events if column resize started from keyboard.
59
+ This will allow continue resizing via mouse
60
+ */
61
+ const { isKeyboardResize } = getTablePluginState(state);
62
+ if (isKeyboardResize) {
63
+ isColumnKeyboardResizeStarted = isKeyboardResize;
67
64
  }
68
65
 
69
66
  if (resizeHandlePos !== null && (!dragging || isColumnKeyboardResizeStarted)) {
package/src/reducer.ts CHANGED
@@ -135,6 +135,7 @@ export default (pluginState: TablePluginState, action: TablePluginAction): Table
135
135
  case 'HOVER_CELL':
136
136
  case 'SHOW_RESIZE_HANDLE_LINE':
137
137
  case 'SET_EDITOR_FOCUS':
138
+ case 'SET_CELL_MENU_OPEN':
138
139
  return { ...pluginState, ...action.data };
139
140
 
140
141
  default:
package/src/types.ts CHANGED
@@ -178,6 +178,7 @@ export interface TablePluginState {
178
178
  // use options.isTableScalingEnabled and avoid using pluginState.isTableScalingEnabled or
179
179
  // const { isTableScalingEnabled } = getPluginState(state) for that purpose.
180
180
  isTableScalingEnabled?: boolean;
181
+ isCellMenuOpenByKeyboard?: boolean;
181
182
  }
182
183
 
183
184
  export type TablePluginAction =
@@ -297,7 +298,13 @@ export type TablePluginAction =
297
298
  | {
298
299
  type: 'HIDE_INSERT_COLUMN_OR_ROW_BUTTON';
299
300
  }
300
- | { type: 'TOGGLE_CONTEXTUAL_MENU' };
301
+ | { type: 'TOGGLE_CONTEXTUAL_MENU' }
302
+ | {
303
+ type: 'SET_CELL_MENU_OPEN';
304
+ data: {
305
+ isCellMenuOpenByKeyboard: boolean;
306
+ };
307
+ };
301
308
 
302
309
  export type ColumnResizingPluginAction =
303
310
  | {
@@ -1,5 +1,5 @@
1
1
  /** @jsx jsx */
2
- import React from 'react';
2
+ import React, { useEffect } from 'react';
3
3
 
4
4
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
5
5
  import { jsx } from '@emotion/react';
@@ -17,6 +17,7 @@ import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
17
17
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
18
18
  import { akEditorSmallZIndex } from '@atlaskit/editor-shared-styles';
19
19
  import ExpandIcon from '@atlaskit/icon/glyph/chevron-down';
20
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
20
21
 
21
22
  import { toggleContextualMenu } from '../../commands';
22
23
  import type { RowStickyState } from '../../pm-plugins/sticky-headers';
@@ -37,6 +38,7 @@ export interface Props {
37
38
  isNumberColumnEnabled?: boolean;
38
39
  stickyHeader?: RowStickyState;
39
40
  dispatchAnalyticsEvent?: DispatchAnalyticsEvent;
41
+ isCellMenuOpenByKeyboard?: boolean;
40
42
  }
41
43
 
42
44
  const BUTTON_OFFSET = 3;
@@ -50,6 +52,7 @@ const FloatingContextualButtonInner = React.memo((props: Props & WrappedComponen
50
52
  stickyHeader,
51
53
  tableWrapper,
52
54
  targetCellPosition,
55
+ isCellMenuOpenByKeyboard,
53
56
  intl: { formatMessage },
54
57
  } = props; // : Props & WrappedComponentProps
55
58
 
@@ -69,6 +72,16 @@ const FloatingContextualButtonInner = React.memo((props: Props & WrappedComponen
69
72
  let targetCellRef: Node | undefined;
70
73
  targetCellRef = findDomRefAtPos(targetCellPosition, domAtPos);
71
74
 
75
+ useEffect(() => {
76
+ if (getBooleanFF('platform.editor.a11y-table-context-menu_y4c9c')) {
77
+ if (isCellMenuOpenByKeyboard && !isContextualMenuOpen) {
78
+ const { state, dispatch } = editorView;
79
+ // open the menu when the keyboard shortcut is pressed
80
+ toggleContextualMenu()(state, dispatch);
81
+ }
82
+ }
83
+ }, [isCellMenuOpenByKeyboard, isContextualMenuOpen, editorView]);
84
+
72
85
  if (!targetCellRef || !(targetCellRef instanceof HTMLElement)) {
73
86
  return null;
74
87
  }
@@ -92,6 +105,11 @@ const FloatingContextualButtonInner = React.memo((props: Props & WrappedComponen
92
105
  onClick={handleClick}
93
106
  iconBefore={<ExpandIcon label="" />}
94
107
  aria-label={labelCellOptions}
108
+ aria-expanded={
109
+ getBooleanFF('platform.editor.a11y-table-context-menu_y4c9c')
110
+ ? isContextualMenuOpen
111
+ : undefined
112
+ }
95
113
  />
96
114
  </div>
97
115
  );