@brightspace-ui/core 2.21.2 → 2.21.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  import { css, html, LitElement } from 'lit';
2
2
  import { findComposedAncestor, getNextAncestorSibling, getPreviousAncestorSibling, isComposedAncestor } from '../../helpers/dom.js';
3
- import { getComposedActiveElement, getFirstFocusableDescendant, getLastFocusableDescendant, isFocusable } from '../../helpers/focus.js';
3
+ import { getComposedActiveElement, getFirstFocusableDescendant, getLastFocusableDescendant, getNextFocusable, getPreviousFocusable, isFocusable } from '../../helpers/focus.js';
4
4
  import { isInteractiveDescendant } from '../../mixins/interactive-mixin.js';
5
5
  import { RtlMixin } from '../../mixins/rtl-mixin.js';
6
6
 
@@ -203,12 +203,19 @@ class ListItemGenericLayout extends RtlMixin(LitElement) {
203
203
  `;
204
204
  }
205
205
 
206
- _focusCellItem(num, itemNum) {
206
+ _focusCellItem(previous, num, itemNum) {
207
207
  const cell = this.shadowRoot && this.shadowRoot.querySelector(`[data-cell-num="${num}"]`);
208
208
  if (!cell) return;
209
209
 
210
210
  const firstFocusable = getFirstFocusableDescendant(cell);
211
- if (!firstFocusable) return;
211
+ if (!firstFocusable) {
212
+ const listItem = findComposedAncestor(this, node => node.role === 'rowgroup');
213
+ if (listItem) {
214
+ const nextFocusable = previous ? getPreviousFocusable(listItem) : getNextFocusable(listItem);
215
+ if (nextFocusable) nextFocusable.focus();
216
+ }
217
+ return;
218
+ }
212
219
 
213
220
  if (itemNum === 1 || !this._focusNextWithinCell(firstFocusable, itemNum)) {
214
221
  firstFocusable.focus();
@@ -283,7 +290,7 @@ class ListItemGenericLayout extends RtlMixin(LitElement) {
283
290
 
284
291
  if (!listItem) return;
285
292
  const listItemRow = listItem.shadowRoot.querySelector('[role="gridrow"]');
286
- listItemRow._focusCellItem(this._cellNum, this._cellFocusedItem);
293
+ listItemRow._focusCellItem(previous, this._cellNum, this._cellFocusedItem);
287
294
 
288
295
  }
289
296
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brightspace-ui/core",
3
- "version": "2.21.2",
3
+ "version": "2.21.3",
4
4
  "description": "A collection of accessible, free, open-source web components for building Brightspace applications",
5
5
  "type": "module",
6
6
  "repository": "https://github.com/BrightspaceUI/core.git",