handsontable 0.0.0-next-a77544c-20231123 → 0.0.0-next-a417c2b-20231124

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.

Potentially problematic release.


This version of handsontable might be problematic. Click here for more details.

package/helpers/mixed.js CHANGED
@@ -134,7 +134,7 @@ const domMessages = {
134
134
  function _injectProductInfo(key, element) {
135
135
  const hasValidType = !isEmpty(key);
136
136
  const isNonCommercial = typeof key === 'string' && key.toLowerCase() === 'non-commercial-and-evaluation';
137
- const hotVersion = "0.0.0-next-a77544c-20231123";
137
+ const hotVersion = "0.0.0-next-a417c2b-20231124";
138
138
  let keyValidityDate;
139
139
  let consoleMessageState = 'invalid';
140
140
  let domMessageState = 'invalid';
package/helpers/mixed.mjs CHANGED
@@ -124,7 +124,7 @@ const domMessages = {
124
124
  export function _injectProductInfo(key, element) {
125
125
  const hasValidType = !isEmpty(key);
126
126
  const isNonCommercial = typeof key === 'string' && key.toLowerCase() === 'non-commercial-and-evaluation';
127
- const hotVersion = "0.0.0-next-a77544c-20231123";
127
+ const hotVersion = "0.0.0-next-a417c2b-20231124";
128
128
  let keyValidityDate;
129
129
  let consoleMessageState = 'invalid';
130
130
  let domMessageState = 'invalid';
package/package.json CHANGED
@@ -10,7 +10,7 @@
10
10
  "url": "https://github.com/handsontable/handsontable/issues"
11
11
  },
12
12
  "author": "Handsoncode <hello@handsontable.com>",
13
- "version": "0.0.0-next-a77544c-20231123",
13
+ "version": "0.0.0-next-a417c2b-20231124",
14
14
  "main": "index",
15
15
  "module": "index.mjs",
16
16
  "jsnext:main": "index.mjs",
@@ -297,7 +297,16 @@ class Filters extends _base.BasePlugin {
297
297
  // A fake menu item that once focused allows escaping from the focus navigation (using Tab keys)
298
298
  // to the menu navigation using arrow keys.
299
299
  {
300
- focus: () => mainMenu.focus()
300
+ focus: () => {
301
+ const menuNavigator = mainMenu.getNavigator();
302
+ const lastSelectedMenuItem = _classPrivateFieldGet(this, _menuFocusNavigator).getLastMenuPage();
303
+ mainMenu.focus();
304
+ if (lastSelectedMenuItem > 0) {
305
+ menuNavigator.setCurrentPage(lastSelectedMenuItem);
306
+ } else {
307
+ menuNavigator.toFirstItem();
308
+ }
309
+ }
301
310
  }, ...Array.from(this.components).map(_ref => {
302
311
  let [, component] = _ref;
303
312
  return component.getElements();
@@ -289,7 +289,16 @@ export class Filters extends BasePlugin {
289
289
  // A fake menu item that once focused allows escaping from the focus navigation (using Tab keys)
290
290
  // to the menu navigation using arrow keys.
291
291
  {
292
- focus: () => mainMenu.focus()
292
+ focus: () => {
293
+ const menuNavigator = mainMenu.getNavigator();
294
+ const lastSelectedMenuItem = _classPrivateFieldGet(this, _menuFocusNavigator).getLastMenuPage();
295
+ mainMenu.focus();
296
+ if (lastSelectedMenuItem > 0) {
297
+ menuNavigator.setCurrentPage(lastSelectedMenuItem);
298
+ } else {
299
+ menuNavigator.toFirstItem();
300
+ }
301
+ }
293
302
  }, ...Array.from(this.components).map(_ref => {
294
303
  let [, component] = _ref;
295
304
  return component.getElements();
@@ -27,12 +27,17 @@ const SHORTCUTS_MENU_CONTEXT = 'filters';
27
27
  * @returns {Paginator}
28
28
  */
29
29
  function createMenuFocusController(mainMenu, menuItems) {
30
- const navigator = (0, _focusNavigator.createFocusNavigator)(menuItems);
30
+ /**
31
+ * @type {number} The last selected menu item (before clearing the the menu state after going
32
+ * into the focus mode triggered by the TAB or SHIFT+TAB keys).
33
+ */
34
+ let lastSelectedMenuItem = -1;
35
+ const focusNavigator = (0, _focusNavigator.createFocusNavigator)(menuItems);
31
36
  const updateNavigatorPosition = element => () => {
32
37
  if (mainMenu.isOpened()) {
33
38
  mainMenu.getKeyboardShortcutsCtrl().listen(SHORTCUTS_MENU_CONTEXT);
34
39
  }
35
- navigator.setCurrentPage(menuItems.indexOf(element));
40
+ focusNavigator.setCurrentPage(menuItems.indexOf(element));
36
41
  };
37
42
 
38
43
  // update navigator position (internal state) to element that was recently clicked or focused
@@ -45,7 +50,7 @@ function createMenuFocusController(mainMenu, menuItems) {
45
50
  });
46
51
  mainMenu.addLocalHook('afterSelectionChange', selectedItem => {
47
52
  if (!selectedItem.key.startsWith('filter_')) {
48
- navigator.clear();
53
+ focusNavigator.clear();
49
54
  }
50
55
  });
51
56
 
@@ -57,7 +62,7 @@ function createMenuFocusController(mainMenu, menuItems) {
57
62
  function addKeyboardShortcuts(menu) {
58
63
  const mainMenuShortcutsCtrl = mainMenu.getKeyboardShortcutsCtrl();
59
64
  const currentMenuShortcutsCtrl = menu.getKeyboardShortcutsCtrl();
60
- navigator.clear();
65
+ focusNavigator.clear();
61
66
  currentMenuShortcutsCtrl.addCustomShortcuts([{
62
67
  keys: [['Tab'], ['Shift', 'Tab']],
63
68
  forwardToContext: mainMenuShortcutsCtrl.getContext(SHORTCUTS_MENU_CONTEXT),
@@ -74,11 +79,15 @@ function createMenuFocusController(mainMenu, menuItems) {
74
79
  mainMenuShortcutsCtrl.addCustomShortcuts([{
75
80
  keys: [['Tab'], ['Shift', 'Tab']],
76
81
  callback: event => {
77
- mainMenu.getNavigator().clear();
82
+ const menuNavigator = mainMenu.getNavigator();
83
+ if (menuNavigator.getCurrentPage() > -1) {
84
+ lastSelectedMenuItem = menuNavigator.getCurrentPage();
85
+ }
86
+ menuNavigator.clear();
78
87
  if (event.shiftKey) {
79
- navigator.toPreviousItem();
88
+ focusNavigator.toPreviousItem();
80
89
  } else {
81
- navigator.toNextItem();
90
+ focusNavigator.toNextItem();
82
91
  }
83
92
  }
84
93
  }, {
@@ -90,7 +99,7 @@ function createMenuFocusController(mainMenu, menuItems) {
90
99
  keys: [['Enter'], ['Space']],
91
100
  preventDefault: false,
92
101
  callback: event => {
93
- const element = menuItems[navigator.getCurrentPage()];
102
+ const element = menuItems[focusNavigator.getCurrentPage()];
94
103
  if (element instanceof _select.SelectUI) {
95
104
  element.openOptions();
96
105
  event.preventDefault();
@@ -116,8 +125,18 @@ function createMenuFocusController(mainMenu, menuItems) {
116
125
  mainMenu.focus();
117
126
  mainMenu.getKeyboardShortcutsCtrl().listen(SHORTCUTS_MENU_CONTEXT);
118
127
  }
128
+
129
+ /**
130
+ * Retrieves the last selected menu item (before clearing the state after going into the focus mode).
131
+ *
132
+ * @returns {number} The last selected menu item.
133
+ */
134
+ function getLastMenuPage() {
135
+ return lastSelectedMenuItem;
136
+ }
119
137
  return {
120
- ...navigator,
121
- listen
138
+ ...focusNavigator,
139
+ listen,
140
+ getLastMenuPage
122
141
  };
123
142
  }
@@ -23,12 +23,17 @@ const SHORTCUTS_MENU_CONTEXT = 'filters';
23
23
  * @returns {Paginator}
24
24
  */
25
25
  export function createMenuFocusController(mainMenu, menuItems) {
26
- const navigator = createFocusNavigator(menuItems);
26
+ /**
27
+ * @type {number} The last selected menu item (before clearing the the menu state after going
28
+ * into the focus mode triggered by the TAB or SHIFT+TAB keys).
29
+ */
30
+ let lastSelectedMenuItem = -1;
31
+ const focusNavigator = createFocusNavigator(menuItems);
27
32
  const updateNavigatorPosition = element => () => {
28
33
  if (mainMenu.isOpened()) {
29
34
  mainMenu.getKeyboardShortcutsCtrl().listen(SHORTCUTS_MENU_CONTEXT);
30
35
  }
31
- navigator.setCurrentPage(menuItems.indexOf(element));
36
+ focusNavigator.setCurrentPage(menuItems.indexOf(element));
32
37
  };
33
38
 
34
39
  // update navigator position (internal state) to element that was recently clicked or focused
@@ -41,7 +46,7 @@ export function createMenuFocusController(mainMenu, menuItems) {
41
46
  });
42
47
  mainMenu.addLocalHook('afterSelectionChange', selectedItem => {
43
48
  if (!selectedItem.key.startsWith('filter_')) {
44
- navigator.clear();
49
+ focusNavigator.clear();
45
50
  }
46
51
  });
47
52
 
@@ -53,7 +58,7 @@ export function createMenuFocusController(mainMenu, menuItems) {
53
58
  function addKeyboardShortcuts(menu) {
54
59
  const mainMenuShortcutsCtrl = mainMenu.getKeyboardShortcutsCtrl();
55
60
  const currentMenuShortcutsCtrl = menu.getKeyboardShortcutsCtrl();
56
- navigator.clear();
61
+ focusNavigator.clear();
57
62
  currentMenuShortcutsCtrl.addCustomShortcuts([{
58
63
  keys: [['Tab'], ['Shift', 'Tab']],
59
64
  forwardToContext: mainMenuShortcutsCtrl.getContext(SHORTCUTS_MENU_CONTEXT),
@@ -70,11 +75,15 @@ export function createMenuFocusController(mainMenu, menuItems) {
70
75
  mainMenuShortcutsCtrl.addCustomShortcuts([{
71
76
  keys: [['Tab'], ['Shift', 'Tab']],
72
77
  callback: event => {
73
- mainMenu.getNavigator().clear();
78
+ const menuNavigator = mainMenu.getNavigator();
79
+ if (menuNavigator.getCurrentPage() > -1) {
80
+ lastSelectedMenuItem = menuNavigator.getCurrentPage();
81
+ }
82
+ menuNavigator.clear();
74
83
  if (event.shiftKey) {
75
- navigator.toPreviousItem();
84
+ focusNavigator.toPreviousItem();
76
85
  } else {
77
- navigator.toNextItem();
86
+ focusNavigator.toNextItem();
78
87
  }
79
88
  }
80
89
  }, {
@@ -86,7 +95,7 @@ export function createMenuFocusController(mainMenu, menuItems) {
86
95
  keys: [['Enter'], ['Space']],
87
96
  preventDefault: false,
88
97
  callback: event => {
89
- const element = menuItems[navigator.getCurrentPage()];
98
+ const element = menuItems[focusNavigator.getCurrentPage()];
90
99
  if (element instanceof SelectUI) {
91
100
  element.openOptions();
92
101
  event.preventDefault();
@@ -112,8 +121,18 @@ export function createMenuFocusController(mainMenu, menuItems) {
112
121
  mainMenu.focus();
113
122
  mainMenu.getKeyboardShortcutsCtrl().listen(SHORTCUTS_MENU_CONTEXT);
114
123
  }
124
+
125
+ /**
126
+ * Retrieves the last selected menu item (before clearing the state after going into the focus mode).
127
+ *
128
+ * @returns {number} The last selected menu item.
129
+ */
130
+ function getLastMenuPage() {
131
+ return lastSelectedMenuItem;
132
+ }
115
133
  return {
116
- ...navigator,
117
- listen
134
+ ...focusNavigator,
135
+ listen,
136
+ getLastMenuPage
118
137
  };
119
138
  }
@@ -5,9 +5,11 @@ exports.__esModule = true;
5
5
  var _menu2 = require("../../../plugins/contextMenu/menu");
6
6
  var _object = require("../../../helpers/object");
7
7
  var _array = require("../../../helpers/array");
8
+ var _element = require("../../../helpers/dom/element");
8
9
  var C = _interopRequireWildcard(require("../../../i18n/constants"));
9
10
  var _predefinedItems = require("../../../plugins/contextMenu/predefinedItems");
10
11
  var _base = require("./_base");
12
+ var _a11y = require("../../../helpers/a11y");
11
13
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
12
14
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
13
15
  function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
@@ -169,6 +171,10 @@ class SelectUI extends _base.BaseUI {
169
171
  _classPrivateFieldSet(this, _caption, caption);
170
172
  _classPrivateFieldSet(this, _captionElement, caption.element);
171
173
  _classPrivateFieldSet(this, _dropdown, dropdown);
174
+ if (this.hot.getSettings().ariaTags) {
175
+ (0, _element.setAttribute)(dropdown.element, [(0, _a11y.A11Y_HIDDEN)()]);
176
+ (0, _element.setAttribute)(this._element, [(0, _a11y.A11Y_LISTBOX)()]);
177
+ }
172
178
  (0, _array.arrayEach)([caption, dropdown], element => this._element.appendChild(element.element));
173
179
  _classPrivateFieldGet(this, _menu).addLocalHook('select', command => _classPrivateMethodGet(this, _onMenuSelect, _onMenuSelect2).call(this, command));
174
180
  _classPrivateFieldGet(this, _menu).addLocalHook('afterClose', () => _classPrivateMethodGet(this, _onMenuClosed, _onMenuClosed2).call(this));
@@ -11,9 +11,11 @@ function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) {
11
11
  import { Menu } from "../../../plugins/contextMenu/menu/index.mjs";
12
12
  import { clone, extend } from "../../../helpers/object.mjs";
13
13
  import { arrayEach } from "../../../helpers/array.mjs";
14
+ import { setAttribute } from "../../../helpers/dom/element.mjs";
14
15
  import * as C from "../../../i18n/constants.mjs";
15
16
  import { SEPARATOR } from "../../../plugins/contextMenu/predefinedItems/index.mjs";
16
17
  import { BaseUI } from "./_base.mjs";
18
+ import { A11Y_HIDDEN, A11Y_LISTBOX } from "../../../helpers/a11y.mjs";
17
19
  /**
18
20
  * @private
19
21
  * @class SelectUI
@@ -164,6 +166,10 @@ export class SelectUI extends BaseUI {
164
166
  _classPrivateFieldSet(this, _caption, caption);
165
167
  _classPrivateFieldSet(this, _captionElement, caption.element);
166
168
  _classPrivateFieldSet(this, _dropdown, dropdown);
169
+ if (this.hot.getSettings().ariaTags) {
170
+ setAttribute(dropdown.element, [A11Y_HIDDEN()]);
171
+ setAttribute(this._element, [A11Y_LISTBOX()]);
172
+ }
167
173
  arrayEach([caption, dropdown], element => this._element.appendChild(element.element));
168
174
  _classPrivateFieldGet(this, _menu).addLocalHook('select', command => _classPrivateMethodGet(this, _onMenuSelect, _onMenuSelect2).call(this, command));
169
175
  _classPrivateFieldGet(this, _menu).addLocalHook('afterClose', () => _classPrivateMethodGet(this, _onMenuClosed, _onMenuClosed2).call(this));
@@ -441,6 +441,7 @@ class NestedRows extends _base.BasePlugin {
441
441
  /**
442
442
  * The modifyRowData hook callback.
443
443
  *
444
+ * @private
444
445
  * @param {number} row Visual row index.
445
446
  * @returns {boolean}
446
447
  */
@@ -454,6 +455,7 @@ class NestedRows extends _base.BasePlugin {
454
455
  /**
455
456
  * Modify the source data length to match the length of the nested structure.
456
457
  *
458
+ * @private
457
459
  * @returns {number}
458
460
  */
459
461
  onModifySourceLength() {
@@ -464,6 +466,7 @@ class NestedRows extends _base.BasePlugin {
464
466
  }
465
467
 
466
468
  /**
469
+ * @private
467
470
  * @param {number} index The index where the data was spliced.
468
471
  * @param {number} amount An amount of items to remove.
469
472
  * @param {object} element An element to add.
@@ -435,6 +435,7 @@ export class NestedRows extends BasePlugin {
435
435
  /**
436
436
  * The modifyRowData hook callback.
437
437
  *
438
+ * @private
438
439
  * @param {number} row Visual row index.
439
440
  * @returns {boolean}
440
441
  */
@@ -448,6 +449,7 @@ export class NestedRows extends BasePlugin {
448
449
  /**
449
450
  * Modify the source data length to match the length of the nested structure.
450
451
  *
452
+ * @private
451
453
  * @returns {number}
452
454
  */
453
455
  onModifySourceLength() {
@@ -458,6 +460,7 @@ export class NestedRows extends BasePlugin {
458
460
  }
459
461
 
460
462
  /**
463
+ * @private
461
464
  * @param {number} index The index where the data was spliced.
462
465
  * @param {number} amount An amount of items to remove.
463
466
  * @param {object} element An element to add.
@@ -4,6 +4,7 @@ exports.__esModule = true;
4
4
  exports.createHighlight = createHighlight;
5
5
  var _src = require("../../../3rdparty/walkontable/src");
6
6
  var _visualSelection = _interopRequireDefault(require("../visualSelection"));
7
+ var _a11y = require("../../../helpers/a11y");
7
8
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
8
9
  /**
9
10
  * Creates the new instance of Selection responsible for highlighting currently selected cell. This type of selection
@@ -11,21 +12,16 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
11
12
  *
12
13
  * @param {object} highlightParams A configuration object to create a highlight.
13
14
  * @param {Function} highlightParams.cellCornerVisible Function to determine if cell's corner should be visible.
14
- * @param {Function} highlightParams.cellAttributes Array of cell attributes.
15
- * @param {Function} highlightParams.headerAttributes Array of header attributes.
16
15
  * @returns {Selection}
17
16
  */
18
17
  function createHighlight(_ref) {
19
18
  let {
20
19
  cellCornerVisible,
21
- cellAttributes,
22
- headerAttributes,
23
20
  ...restOptions
24
21
  } = _ref;
25
22
  return new _visualSelection.default({
26
23
  className: 'current',
27
- cellAttributes,
28
- focusedHeaderAttributes: headerAttributes,
24
+ headerAttributes: [(0, _a11y.A11Y_SELECTED)()],
29
25
  border: {
30
26
  width: 2,
31
27
  color: '#4b89ff',
@@ -1,26 +1,22 @@
1
1
  import { HIGHLIGHT_FOCUS_TYPE } from "../../../3rdparty/walkontable/src/index.mjs";
2
2
  import VisualSelection from "../visualSelection.mjs";
3
+ import { A11Y_SELECTED } from "../../../helpers/a11y.mjs";
3
4
  /**
4
5
  * Creates the new instance of Selection responsible for highlighting currently selected cell. This type of selection
5
6
  * can present on the table only one at the time.
6
7
  *
7
8
  * @param {object} highlightParams A configuration object to create a highlight.
8
9
  * @param {Function} highlightParams.cellCornerVisible Function to determine if cell's corner should be visible.
9
- * @param {Function} highlightParams.cellAttributes Array of cell attributes.
10
- * @param {Function} highlightParams.headerAttributes Array of header attributes.
11
10
  * @returns {Selection}
12
11
  */
13
12
  export function createHighlight(_ref) {
14
13
  let {
15
14
  cellCornerVisible,
16
- cellAttributes,
17
- headerAttributes,
18
15
  ...restOptions
19
16
  } = _ref;
20
17
  return new VisualSelection({
21
18
  className: 'current',
22
- cellAttributes,
23
- focusedHeaderAttributes: headerAttributes,
19
+ headerAttributes: [A11Y_SELECTED()],
24
20
  border: {
25
21
  width: 2,
26
22
  color: '#4b89ff',
@@ -99,7 +99,6 @@ class Selection {
99
99
  this.tableProps = tableProps;
100
100
  this.highlight = new _highlight.default({
101
101
  headerClassName: settings.currentHeaderClassName,
102
- headerAttributes: [(0, _a11y.A11Y_SELECTED)()],
103
102
  activeHeaderClassName: settings.activeHeaderClassName,
104
103
  rowClassName: settings.currentRowClassName,
105
104
  columnClassName: settings.currentColClassName,
@@ -93,7 +93,6 @@ class Selection {
93
93
  this.tableProps = tableProps;
94
94
  this.highlight = new Highlight({
95
95
  headerClassName: settings.currentHeaderClassName,
96
- headerAttributes: [A11Y_SELECTED()],
97
96
  activeHeaderClassName: settings.activeHeaderClassName,
98
97
  rowClassName: settings.currentRowClassName,
99
98
  columnClassName: settings.currentColClassName,
package/tableView.js CHANGED
@@ -1158,8 +1158,10 @@ class TableView {
1158
1158
  const span = rootDocument.createElement('span');
1159
1159
  div.className = 'relative';
1160
1160
  span.className = 'colHeader';
1161
- (0, _element.setAttribute)(div, ...(0, _a11y.A11Y_PRESENTATION)());
1162
- (0, _element.setAttribute)(span, ...(0, _a11y.A11Y_PRESENTATION)());
1161
+ if (this.settings.ariaTags) {
1162
+ (0, _element.setAttribute)(div, ...(0, _a11y.A11Y_PRESENTATION)());
1163
+ (0, _element.setAttribute)(span, ...(0, _a11y.A11Y_PRESENTATION)());
1164
+ }
1163
1165
  this.updateCellHeader(span, visualColumnIndex, label, headerLevel);
1164
1166
  div.appendChild(span);
1165
1167
  TH.appendChild(div);
package/tableView.mjs CHANGED
@@ -1154,8 +1154,10 @@ class TableView {
1154
1154
  const span = rootDocument.createElement('span');
1155
1155
  div.className = 'relative';
1156
1156
  span.className = 'colHeader';
1157
- setAttribute(div, ...A11Y_PRESENTATION());
1158
- setAttribute(span, ...A11Y_PRESENTATION());
1157
+ if (this.settings.ariaTags) {
1158
+ setAttribute(div, ...A11Y_PRESENTATION());
1159
+ setAttribute(span, ...A11Y_PRESENTATION());
1160
+ }
1159
1161
  this.updateCellHeader(span, visualColumnIndex, label, headerLevel);
1160
1162
  div.appendChild(span);
1161
1163
  TH.appendChild(div);