@fundamental-ngx/platform 0.62.0-rc.2 → 0.62.0-rc.21

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.
@@ -994,6 +994,8 @@ class ListComponent extends CollectionBaseInput {
994
994
  this._subscriptions.add(this.listItems.changes
995
995
  .pipe(startWith(this.listItems), observeOn(asyncScheduler))
996
996
  .subscribe(() => this._updateListItems()));
997
+ // Listen for active item changes to update roving tabindex
998
+ this._subscriptions.add(this._keyManager.change.subscribe(() => this._updateTabIndexes()));
997
999
  const indicator = this.elementRef.nativeElement.querySelector('fd-busy-indicator');
998
1000
  indicator?.setAttribute('aria-label', '');
999
1001
  }
@@ -1289,9 +1291,8 @@ class ListComponent extends CollectionBaseInput {
1289
1291
  * set values when passed via datasource
1290
1292
  */
1291
1293
  _updateListItems() {
1292
- if (this.listItems.length !== 0) {
1293
- this.listItems.first.listItem.nativeElement.setAttribute('tabindex', '0');
1294
- }
1294
+ // Update roving tabindex
1295
+ this._updateTabIndexes();
1295
1296
  this._ariaSetSize = this.ariaSetsize
1296
1297
  ? of(this.ariaSetsize)
1297
1298
  : this._dataSource && this._dataSource.dataProvider?.getTotalItems
@@ -1328,6 +1329,39 @@ class ListComponent extends CollectionBaseInput {
1328
1329
  });
1329
1330
  this.markForCheck();
1330
1331
  }
1332
+ /**
1333
+ * @hidden
1334
+ * Updates tabindex on all list items based on the current tabbable index.
1335
+ */
1336
+ _updateTabIndexes() {
1337
+ if (this.listItems.length === 0) {
1338
+ return;
1339
+ }
1340
+ const tabbableIndex = this._getTabbableItemIndex();
1341
+ this.listItems.forEach((item, index) => {
1342
+ item.listItem.nativeElement.setAttribute('tabindex', index === tabbableIndex ? '0' : '-1');
1343
+ });
1344
+ }
1345
+ /**
1346
+ * @hidden
1347
+ * Determines which item should have tabindex="0".
1348
+ * Priority: 1) Active item (keyboard focused), 2) First selected item, 3) First item
1349
+ */
1350
+ _getTabbableItemIndex() {
1351
+ // If keyManager has an active item, use that
1352
+ const activeIndex = this._keyManager?.activeItemIndex;
1353
+ if (activeIndex != null && activeIndex >= 0) {
1354
+ return activeIndex;
1355
+ }
1356
+ // Otherwise, find the first selected item
1357
+ const listItemsArray = this.listItems.toArray();
1358
+ const firstSelectedIndex = listItemsArray.findIndex((item) => item._selected);
1359
+ if (firstSelectedIndex >= 0) {
1360
+ return firstSelectedIndex;
1361
+ }
1362
+ // Default to first item
1363
+ return 0;
1364
+ }
1331
1365
  /** @hidden */
1332
1366
  _waitForViewInit() {
1333
1367
  return (source) => source.pipe(switchMap((src) => this._afterViewInit$.pipe(filter((afterViewInit) => afterViewInit), map(() => src))));