Take a look at this (overly simplified) snippet:
HTML
<div class="container">
<button class="no-select">Button</button>
Container Text
</div>
CSS
.no-select {
user-select: none; /* For comprehension sake, pretend this works for every browsers */
}
When clicking, dragging or double-clicking the button on desktop, it works as expected: the text inside the button is not highlighted.
Long-pressing the button on mobile still doesn't select the text inside the button, but instead starts selecting the parent's text. More precisely, it selects the next "selectable" thing it can. In this case, it would be the container text (Container Text). I've only tested on iOS, someone could confirm for other devices?
You can also see this behavior on Material-UI's buttons. Long-press one of the buttons on iOS and you will see the bug.
How do you prevent this behavior from happening?