@brightspace-ui/core 2.45.4 → 2.45.5

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.
@@ -208,17 +208,13 @@ class ListItemGenericLayout extends RtlMixin(LitElement) {
208
208
  if (!cell) return;
209
209
 
210
210
  const firstFocusable = getFirstFocusableDescendant(cell);
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
- }
211
+ if (!firstFocusable) return;
219
212
 
220
- if (itemNum === 1 || !this._focusNextWithinCell(firstFocusable, itemNum)) {
213
+ if (itemNum === 1) {
221
214
  firstFocusable.focus();
215
+ return firstFocusable;
216
+ } else {
217
+ return this._focusNextWithinCell(firstFocusable, itemNum);
222
218
  }
223
219
  }
224
220
 
@@ -290,7 +286,16 @@ class ListItemGenericLayout extends RtlMixin(LitElement) {
290
286
 
291
287
  if (!listItem) return;
292
288
  const listItemRow = listItem.shadowRoot.querySelector('[role="gridrow"]');
293
- listItemRow._focusCellItem(previous, this._cellNum, this._cellFocusedItem);
289
+ const focusedCellItem = listItemRow._focusCellItem(previous, this._cellNum, this._cellFocusedItem);
290
+
291
+ if (!focusedCellItem) {
292
+ // could not focus on same cell in adjacent list-item so try general focus on item
293
+ if (!listItem._tryFocus()) {
294
+ // ultimate fallback to generic method for getting next/previous focusable
295
+ const nextFocusable = previous ? getPreviousFocusable(listItem) : getNextFocusable(listItem);
296
+ if (nextFocusable) nextFocusable.focus();
297
+ }
298
+ }
294
299
 
295
300
  }
296
301
 
@@ -398,8 +398,7 @@ export const ListItemMixin = superclass => class extends LocalizeCoreElement(Lis
398
398
  }
399
399
 
400
400
  focus() {
401
- const node = getFirstFocusableDescendant(this);
402
- if (node) node.focus();
401
+ this._tryFocus();
403
402
  }
404
403
 
405
404
  async highlight() {
@@ -623,4 +622,11 @@ export const ListItemMixin = superclass => class extends LocalizeCoreElement(Lis
623
622
  `;
624
623
  }
625
624
 
625
+ _tryFocus() {
626
+ const node = getFirstFocusableDescendant(this);
627
+ if (!node) return false;
628
+ node.focus();
629
+ return true;
630
+ }
631
+
626
632
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brightspace-ui/core",
3
- "version": "2.45.4",
3
+ "version": "2.45.5",
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",