Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

User select:none causes input field to be inaccessible on Safari

Tags:

html

css

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?

like image 830
user823527 Avatar asked May 30 '12 15:05

user823527


2 Answers

Why not just apply the style to everything but the inputs?

css3 way: *:not(input){...}

like image 90
Tom Pietrosanti Avatar answered Sep 21 '22 17:09

Tom Pietrosanti


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;
}
like image 41
Vlad Levitskiy Avatar answered Sep 21 '22 17:09

Vlad Levitskiy