Skip to content

Commit

Permalink
fix(list): fix strong focus first keyboard nav
Browse files Browse the repository at this point in the history
fixes an issue where first keyboard navigation would not show strong focus because event listeners flush the event queue and the keyboard event doesn't reach window before focus is called

PiperOrigin-RevId: 518731054
  • Loading branch information
material-web-copybara authored and copybara-github committed Mar 23, 2023
1 parent d7fdfda commit 6398186
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions list/lib/list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {ClassInfo, classMap} from 'lit/directives/class-map.js';
import {ifDefined} from 'lit/directives/if-defined.js';

import {ariaProperty} from '../../decorators/aria-property.js';
import {keydownHandler} from '../../focus/strong-focus.js';
import {ARIARole} from '../../types/aria.js';

import {ListItem} from './listitem/list-item.js';
Expand Down Expand Up @@ -129,6 +130,7 @@ export class List extends LitElement {
activeItemRecord.item.active = false;
}

keydownHandler(event);
event.preventDefault();

switch (key) {
Expand Down

0 comments on commit 6398186

Please sign in to comment.