Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Selecting text can be useful, but it can also become its own usability problem.

I recently created a touch interface using a websocket/browser based stack and one of the problem was that users kept selecting the text on buttons because they expected some action while holding the button.



https://caniuse.com/user-select-none + pointer-events + touch-action : )


I currently have the same issue while building a canvas web app. Safari shows a small magnifier glass on double tap/long press and none of the css properties will suppress it.


I think you can work around it by listening on the touchstart event on your element and calling e.preventDefault(). Don't have an iPhone handy to test it right now, but I believe that's how I fixed that issue in my web game.


Thank you for the suggestion. This is also what is discussed in some stackoverflow threads on that topic. I simply do not get why javascript is required to stop the browser from interfering with user actions. Calling preventDefault also messes with element focus and other events.


Yeah, I am not the biggest fan of iOS Safari because of things like these. In my case, disabling most default interactions was a desirable property because I wanted to handle all the UI myself - but I understand that may not always be a good solution.


This is what I used




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: