Skip to content

Commit bcc18dd

Browse files
committed
chore: updated menu interaction model
1 parent 344344e commit bcc18dd

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

packages/menu/src/Menu.ts

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -342,22 +342,20 @@ export class Menu extends SizedMixin(SpectrumElement, { noDefaultSize: true }) {
342342
}
343343
}
344344

345-
private willSynthesizeClick = 0;
345+
// if the click and pointerup events are on the same target, we should not
346+
// handle the click event.
347+
private pointerUpTarget = null as EventTarget | null;
346348

347349
private handleClick(event: Event): void {
348-
if (this.willSynthesizeClick) {
349-
cancelAnimationFrame(this.willSynthesizeClick);
350-
this.willSynthesizeClick = 0;
350+
if (this.pointerUpTarget === event.target) {
351+
this.pointerUpTarget = null;
351352
return;
352353
}
353354
this.handlePointerBasedSelection(event);
354355
}
355356

356357
private handlePointerup(event: Event): void {
357-
this.willSynthesizeClick = requestAnimationFrame(() => {
358-
event.target?.dispatchEvent(new Event('click'));
359-
this.willSynthesizeClick = 0;
360-
});
358+
this.pointerUpTarget = event.target;
361359
this.handlePointerBasedSelection(event);
362360
}
363361

0 commit comments

Comments
 (0)