@@ -16,23 +16,20 @@ import {
1616} from './event-manager' ;
1717
1818/**
19- * Gets whether an event could be a faked click event dispatched by a screen reader
20- * or generated by the browser when Enter or Space keys are pressed.
19+ * Gets whether an event could be a simulated click event.
20+ *
21+ * Screen readers and keyboard activation (Enter/Space) often dispatch fake click
22+ * events. We distinguish them by checking if `event.detail` is zero or if
23+ * `event.pointerType` is missing.
2124 */
2225export function isFakeClick ( event : PointerEvent ) : boolean {
23- // Some screen readers will dispatch a fake click event when pressing enter or space on
24- // a clickable element. We can distinguish these events when `event.buttons` is zero, or
25- // `event.detail` is zero depending on the browser:
26- // - `event.buttons` works on Firefox, but fails on Chrome.
27- // - `detail` works on Chrome, but fails on Firefox.
28- // Also, fake events might not have a valid pointerType.
29- return event . buttons === 0 || event . detail === 0 || ! event . pointerType ;
26+ return event . detail === 0 || ! event . pointerType ;
3027}
3128
3229/**
3330 * An event manager that is specialized for handling click events.
3431 *
35- * This manager should ONLY be used to handle pointer events. It explicitly
32+ * This manager should ONLY be used to handle click events. It explicitly
3633 * filters out simulated click events generated by browsers when Enter or Space
3734 * keys are pressed, to avoid concurrent logic or overwriting selection state
3835 * when handling keyboard activation explicitly via KeyboardEventManager.
0 commit comments