Tapping and holding on a DIV causes Safari to select (i.e. highlight) the surrounding text and the phone to vibrate, even if this DIV has a user-select
property set to none
. This is very annoying in the context of my app. It seems to be specific to iOS 13 and its Haptic Touch.
I tried to e.preventDefault()
on the touchstart
event and it worked, but at the same time disabled scrolling capabilities.
I also tried to e.preventDefault()
on the webkitmouseforcewillbegin
event, as remended in the Apple documentation, but this didn't work at all.
Anyone knows how to fix this?
Video:
Tapping and holding on a DIV causes Safari to select (i.e. highlight) the surrounding text and the phone to vibrate, even if this DIV has a user-select
property set to none
. This is very annoying in the context of my app. It seems to be specific to iOS 13 and its Haptic Touch.
I tried to e.preventDefault()
on the touchstart
event and it worked, but at the same time disabled scrolling capabilities.
I also tried to e.preventDefault()
on the webkitmouseforcewillbegin
event, as remended in the Apple documentation, but this didn't work at all.
Anyone knows how to fix this?
Video: https://youtu.be/SstDm0M8RN0
Share Improve this question asked May 17, 2020 at 16:21 tavoynetavoyne 6,5692 gold badges16 silver badges26 bronze badges1 Answer
Reset to default 3Calling event.returnValue = false;
from all touch events (touchstart
, touchend
, touchmove
, touchcancel
) prevents from the surrounding text selection.
Here is fiddle: https://jsfiddle/j_u_l_e_e/yLdt1s4o/