[w3c/selection-api] Specify when the selection collapsing happen on mouse click (#90)

Problem: The order between selection collapsing and click event is different across browsers

Demo: http://codepen.io/SaschaNaz/pen/wdeqZX

This small code listens click event, checks `window.getSelection().isCollapsed`, and opens a popup only when the selection is collapsed.

Howto:

![click-selection](https://cloud.githubusercontent.com/assets/3396686/25632561/077a5f3e-2faf-11e7-8657-48d98d0a9bad.gif)

Browsers show different behavior here. In the click listener, Edge 15.16184 preview and Firefox 53 get collapsed selection, Edge 15.15063 and Chrome get non-collapsed selection (although Chrome suffers race condition and sometimes gets true).

I'm using selection check on click listener to allow users freely click anywhere to deselect text without worrying button click, but this inconsistency blocks my use case.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/selection-api/issues/90

Received on Tuesday, 2 May 2017 18:29:05 UTC