Skip to content

Commit

Permalink
refactor(list)!: refactor list to reuse ListController
Browse files Browse the repository at this point in the history
fixes #4967

also fixes list-root focus ring and focusout

BREAKING CHANGE: the new ListController behavior no longer waits for event.preventDefault asynchronously because it was causing keyboard navigations to scroll the page.

PiperOrigin-RevId: 568300155
  • Loading branch information
Elliott Marquez authored and copybara-github committed Sep 25, 2023
1 parent c789c99 commit 6d0c7e8
Show file tree
Hide file tree
Showing 11 changed files with 61 additions and 462 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -206,23 +206,23 @@ export class ListController<Item extends ListItem> {
/**
* Listener to be bound to the `deactivate-items` item event.
*/
onDeactivateItems() {
onDeactivateItems = () => {
const items = this.items;

for (const item of items) {
this.deactivateItem(item);
}
}
};

/**
* Listener to be bound to the `request-activation` item event..
*/
onRequestActivation(event: Event) {
onRequestActivation = (event: Event) => {
this.onDeactivateItems();
const target = event.target as Item;
this.activateItem(target);
target.focus();
}
};

/**
* Listener to be bound to the `slotchange` event for the slot that renders
Expand Down
File renamed without changes.
Loading

0 comments on commit 6d0c7e8

Please sign in to comment.