Event on End of Selection?

Is there an event that fires when a selection has completed? By this I mean is there an event that fires when:

  • A user has dragged their cursor over a region of text; and then
  • Released their cursor

Or alternatively when:

  • A user has double-clicked/tapped text to select it; or
  • A user has used keys to edit/create a selection, and is no longer selecting those keys?

I can’t find a perfect event that matches the above description, all I can see is beforeSelectionChange, which I can debounce to mimic the above event, but doesn’t tell me when a user releases their cursor.

I would appreciate any suggestions for events I can use, or ways I can mimic the above behaviour.

No, this doesn’t exist. You might be able to cobble something together by combining a debounced "change" event listener with "mousedown"/"mouseup" handlers that track the mouse button state.

1 Like