With these css styles I prevent the highlighted text selection on a page. But this causes the input fields to be locked from user input on Safari.
* {
-webkit-touch-callout: none;
-webkit-user-select: none; // locks fields on Safari
-khtml-user-select: none; // locks fields on Safari
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
Is there a way on Safari to prevent user selection without interfering with input fields?
Why not just apply the style to everything but the inputs?
css3 way:
*:not(input){...}
Nothing new :)
*:not(input, textarea){
-webkit-touch-callout: none;
-webkit-user-select: none; // locks fields on Safari
-khtml-user-select: none; // locks fields on Safari
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With