Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Specify when the selection collapsing happen on mouse click #90

Open
saschanaz opened this issue May 2, 2017 · 0 comments
Open

Specify when the selection collapsing happen on mouse click #90

saschanaz opened this issue May 2, 2017 · 0 comments

Comments

@saschanaz
Copy link
Member

saschanaz commented May 2, 2017

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

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.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants