@@ -64,15 +64,8 @@ function onKeyup(e: KeyboardEvent) {
6464 }
6565}
6666
67- // The pointer events we intercept to make sure no external library ever hears
68- // about a click before driver.js does. `click` carries the actual handler; the
69- // rest are only suppressed.
7067const DRIVER_CLICK_EVENTS = [ "pointerdown" , "mousedown" , "pointerup" , "mouseup" , "click" ] as const ;
7168
72- // Associates each driver element with the single document-level handler that
73- // was registered on its behalf, so it can be removed when the element is torn
74- // down. A WeakMap keyed by the element avoids leaking handlers onto `document`
75- // (the popover is rebuilt every step) and needs no id bookkeeping on the DOM.
7669const driverClickHandlers = new WeakMap < Element , ( e : MouseEvent | PointerEvent ) => void > ( ) ;
7770
7871/**
@@ -90,8 +83,6 @@ export function onDriverClick(
9083 listener : ( pointer : MouseEvent | PointerEvent ) => void ,
9184 shouldPreventDefault ?: ( target : HTMLElement ) => boolean
9285) {
93- // Defensive: if this element somehow already has a handler attached, remove
94- // it first so we never register duplicates.
9586 destroyDriverClick ( element ) ;
9687
9788 const handler = ( e : MouseEvent | PointerEvent ) => {
@@ -106,8 +97,6 @@ export function onDriverClick(
10697 e . stopImmediatePropagation ( ) ;
10798 }
10899
109- // Only the actual click should invoke the user's listener; the other
110- // events exist purely to suppress interaction beneath the overlay/popover.
111100 if ( e . type === "click" ) {
112101 listener ?.( e ) ;
113102 }
0 commit comments