Skip to content

Commit 7170bc8

Browse files
committed
fix(core): allow dynamically added options to receive keyboard focus
1 parent e594b00 commit 7170bc8

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

core/pfe-core/controllers/at-focus-controller.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,14 @@ export abstract class ATFocusController<Item extends HTMLElement> {
118118
this.itemsContainerElement ??= this.#initContainer();
119119
}
120120

121+
/**
122+
* Refresh items from the getItems option. Call this when the list of items
123+
* has changed (e.g. when a parent controller sets items).
124+
*/
125+
refreshItems(): void {
126+
this.initItems();
127+
}
128+
121129
hostConnected(): void {
122130
this.hostUpdate();
123131
}

core/pfe-core/controllers/combobox-controller.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,7 @@ export class ComboboxController<
281281

282282
set items(value: Item[]) {
283283
this.#lb.items = value;
284+
this.#fc?.refreshItems?.();
284285
}
285286

286287
/** Whether the combobox is disabled */

0 commit comments

Comments
 (0)