Skip to content

Commit

Permalink
fix(menu): release synthetic "click" promise to unblock keyboard inte…
Browse files Browse the repository at this point in the history
…ractions
  • Loading branch information
Westbrook committed Mar 8, 2024
1 parent dcfc96e commit f8aecf3
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/menu/src/Menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,7 @@ export class Menu extends SizedMixin(SpectrumElement, { noDefaultSize: true }) {
private handleClick(event: Event): void {
if (this.willSynthesizeClick) {
cancelAnimationFrame(this.willSynthesizeClick);
this.willSynthesizeClick = 0;
return;
}
this.handlePointerBasedSelection(event);
Expand All @@ -352,6 +353,7 @@ export class Menu extends SizedMixin(SpectrumElement, { noDefaultSize: true }) {
private handlePointerup(event: Event): void {
this.willSynthesizeClick = requestAnimationFrame(() => {
event.target?.dispatchEvent(new Event('click'));
this.willSynthesizeClick = 0;
});
this.handlePointerBasedSelection(event);
}
Expand Down

0 comments on commit f8aecf3

Please # to comment.