@@ -55,7 +55,7 @@ export const SelectionHandler = (
55
55
56
56
const onSelectStart = ( evt : Event ) => {
57
57
isContextMenuOpen = false ;
58
-
58
+
59
59
if ( isLeftClick === false )
60
60
return ;
61
61
@@ -250,7 +250,7 @@ export const SelectionHandler = (
250
250
let isCollapsed = sel ?. isCollapsed ;
251
251
const shouldStopPolling = ( ) => isCollapsed || stopPolling ;
252
252
253
- const pollingDelayMs = 2 ;
253
+ const pollingDelayMs = 10 ;
254
254
const stopPollingInMs = 50 ;
255
255
setTimeout ( ( ) => stopPolling = true , stopPollingInMs ) ;
256
256
@@ -264,12 +264,12 @@ export const SelectionHandler = (
264
264
265
265
if ( sel ?. isCollapsed ) return ;
266
266
267
- // When selecting the initial word, Chrome Android fires `contextmenu`
267
+ // When selecting the initial word, Chrome Android fires `contextmenu`
268
268
// before selectionChanged.
269
269
if ( ! currentTarget || currentTarget . selector . length === 0 ) {
270
270
onSelectionChange ( evt ) ;
271
271
}
272
-
272
+
273
273
upsertCurrentTarget ( ) ;
274
274
275
275
selection . userSelect ( currentTarget . annotation , clonePointerEvent ( evt ) ) ;
@@ -301,15 +301,15 @@ export const SelectionHandler = (
301
301
302
302
selection . userSelect ( currentTarget . annotation , cloneKeyboardEvent ( evt ) ) ;
303
303
}
304
-
304
+
305
305
document . removeEventListener ( 'selectionchange' , onSelected ) ;
306
306
307
307
// Sigh... this needs a delay to work. But doesn't seem reliable.
308
308
} , 100 ) ;
309
309
310
310
// Listen to the change event that follows
311
311
document . addEventListener ( 'selectionchange' , onSelected ) ;
312
-
312
+
313
313
// Start selection!
314
314
onSelectStart ( evt ) ;
315
315
}
0 commit comments