diff --git a/list/internal/list-controller.ts b/list/internal/list-controller.ts index 707ab2fb05..ee0b420b7a 100644 --- a/list/internal/list-controller.ts +++ b/list/internal/list-controller.ts @@ -138,6 +138,14 @@ export class ListController { return items; } + /** + * Retrieves the first activated item of the array of items regarding + * controller's configuration. + */ + get activeItem() { + return getActiveItem(this.items, this.isActivatable); + } + /** * Handles keyboard navigation. Should be bound to the node that will act as * the List. diff --git a/list/internal/list.ts b/list/internal/list.ts index c5ec9dbb9f..4788a545f1 100644 --- a/list/internal/list.ts +++ b/list/internal/list.ts @@ -90,4 +90,14 @@ export class List extends LitElement { activatePreviousItem(): ListItem | null { return this.listController.activatePreviousItem(); } + + /** + * Retrieves the first activated item of the array of items. + * + * @return A record of the first activated item including the item and the + * index of the item or `null` if none are activated. + */ + get activeItem() { + return this.listController.activeItem; + } }