You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This small code listens click event, checks window.getSelection().isCollapsed, and opens a popup only when the selection is collapsed.
Howto:
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 collapsed one).
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. (I expect every browser get non-collapsed selection on click listener.)
The text was updated successfully, but these errors were encountered:
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:
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 collapsed one).
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. (I expect every browser get non-collapsed selection on click listener.)
The text was updated successfully, but these errors were encountered: