3 ms·
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
by atoav 2y ago
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.
- iknowstuff 2y agohttps://caniuse.com/user-select-none https://caniuse.com/user-select-none + pointer-events + touch-action : )
- laszlokorte 2y agoI 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.
- GranPC 2y agoI 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.
- laszlokorte 2y agoThank 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.
- GranPC 2y agoYeah, 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.
- atoav 2y agoThis is what I used