From 961782b78e5f0379a535ecdaa39d7c1939648afb Mon Sep 17 00:00:00 2001 From: Jouni Koivuviita Date: Tue, 19 Aug 2014 20:07:04 +0300 Subject: [PATCH] Prevent user text selection by default (Valo) Re-enable for labels, captions, tables and text inputs. Removed all unnecessary user-select: none; declarations since the top level declaration will affect the whole dom tree. Change-Id: I2e74b749340c8649d3b0778d62acafecf878685d --- .../themes/valo/components/_accordion.scss | 1 - .../themes/valo/components/_datefield.scss | 6 ++--- .../themes/valo/components/_dragwrapper.scss | 1 - .../VAADIN/themes/valo/components/_label.scss | 4 ++++ .../VAADIN/themes/valo/components/_table.scss | 1 + .../themes/valo/components/_tabsheet.scss | 1 - .../themes/valo/components/_textfield.scss | 1 + .../VAADIN/themes/valo/components/_tree.scss | 1 - .../themes/valo/components/_window.scss | 1 - .../VAADIN/themes/valo/fonts/_fonts.scss | 1 - .../VAADIN/themes/valo/shared/_global.scss | 24 +++++++++++++++---- WebContent/VAADIN/themes/valo/util/_util.scss | 1 - 12 files changed, 27 insertions(+), 16 deletions(-) diff --git a/WebContent/VAADIN/themes/valo/components/_accordion.scss b/WebContent/VAADIN/themes/valo/components/_accordion.scss index 82a4396828..e5457a2331 100644 --- a/WebContent/VAADIN/themes/valo/components/_accordion.scss +++ b/WebContent/VAADIN/themes/valo/components/_accordion.scss @@ -85,7 +85,6 @@ } border-bottom-color: first-color(valo-border($color: $v-panel-background-color)); cursor: pointer; - @include user-select(none);; &:hover:before, &:active:before { diff --git a/WebContent/VAADIN/themes/valo/components/_datefield.scss b/WebContent/VAADIN/themes/valo/components/_datefield.scss index 521d661a3d..81c7fa0e5e 100644 --- a/WebContent/VAADIN/themes/valo/components/_datefield.scss +++ b/WebContent/VAADIN/themes/valo/components/_datefield.scss @@ -236,10 +236,8 @@ @mixin valo-datefield-popup-style { @include valo-overlay-style; - @include user-select(none); - - margin-top: ceil($v-unit-size/8) !important; - cursor: default; + margin-top: ceil($v-unit-size/8) !important; + cursor: default; width: auto; table { diff --git a/WebContent/VAADIN/themes/valo/components/_dragwrapper.scss b/WebContent/VAADIN/themes/valo/components/_dragwrapper.scss index 6527e42ed7..1eaf078661 100644 --- a/WebContent/VAADIN/themes/valo/components/_dragwrapper.scss +++ b/WebContent/VAADIN/themes/valo/components/_dragwrapper.scss @@ -3,7 +3,6 @@ [draggable=true] { -khtml-user-drag: element; -webkit-user-drag: element; - @include user-select(none); } .#{$primary-stylename}.v-active-drag-source { diff --git a/WebContent/VAADIN/themes/valo/components/_label.scss b/WebContent/VAADIN/themes/valo/components/_label.scss index e61aa4ec11..655ef6e1cc 100644 --- a/WebContent/VAADIN/themes/valo/components/_label.scss +++ b/WebContent/VAADIN/themes/valo/components/_label.scss @@ -21,6 +21,10 @@ $v-letter-spacing--h4: 0 !default; @mixin valo-label ($primary-stylename: v-label, $include-additional-styles: contains($v-included-additional-styles, label)) { + .#{$primary-stylename} { + @include user-select(text); + } + .#{$primary-stylename}-undef-w { white-space: nowrap; } diff --git a/WebContent/VAADIN/themes/valo/components/_table.scss b/WebContent/VAADIN/themes/valo/components/_table.scss index adac1b90bd..36e0565c83 100644 --- a/WebContent/VAADIN/themes/valo/components/_table.scss +++ b/WebContent/VAADIN/themes/valo/components/_table.scss @@ -199,6 +199,7 @@ $v-table-background-color: null !default; .#{$primary-stylename}-body { border: $v-table-border-width solid $border-color; + @include user-select(text); } .#{$primary-stylename}-table { diff --git a/WebContent/VAADIN/themes/valo/components/_tabsheet.scss b/WebContent/VAADIN/themes/valo/components/_tabsheet.scss index 7f2421b5ff..ccd70c4328 100644 --- a/WebContent/VAADIN/themes/valo/components/_tabsheet.scss +++ b/WebContent/VAADIN/themes/valo/components/_tabsheet.scss @@ -161,7 +161,6 @@ $v-tabsheet-content-animation-enabled: $v-animations-enabled !default; @mixin valo-tabsheet-tabcontainer-style ($primary-stylename: v-tabsheet) { position: relative; - @include user-select(none); @include box-sizing(border-box); &:before { diff --git a/WebContent/VAADIN/themes/valo/components/_textfield.scss b/WebContent/VAADIN/themes/valo/components/_textfield.scss index 85e2487bc1..f0b0ec2532 100644 --- a/WebContent/VAADIN/themes/valo/components/_textfield.scss +++ b/WebContent/VAADIN/themes/valo/components/_textfield.scss @@ -95,6 +95,7 @@ $v-textfield-disabled-opacity: $v-disabled-opacity !default; @if contains($states, normal) { @include appearance(none); + @include user-select(text); margin: 0; font: inherit; font-size: $font-size; diff --git a/WebContent/VAADIN/themes/valo/components/_tree.scss b/WebContent/VAADIN/themes/valo/components/_tree.scss index 8e75f59945..3cf4aed760 100644 --- a/WebContent/VAADIN/themes/valo/components/_tree.scss +++ b/WebContent/VAADIN/themes/valo/components/_tree.scss @@ -29,7 +29,6 @@ $v-tree-expand-animation-enabled: false !default; .#{$primary-stylename} { position: relative; white-space: nowrap; - @include user-select(none); &:focus { outline: none; diff --git a/WebContent/VAADIN/themes/valo/components/_window.scss b/WebContent/VAADIN/themes/valo/components/_window.scss index b958be79da..cdd2298499 100644 --- a/WebContent/VAADIN/themes/valo/components/_window.scss +++ b/WebContent/VAADIN/themes/valo/components/_window.scss @@ -102,7 +102,6 @@ $v-window-modality-curtain-background-color: #222 !default; } .#{$primary-stylename}-header { - @include user-select(none); cursor: move; line-height: $v-unit-size - 1px; padding-left: round($v-unit-size/3); diff --git a/WebContent/VAADIN/themes/valo/fonts/_fonts.scss b/WebContent/VAADIN/themes/valo/fonts/_fonts.scss index b33e14d5d2..8f0a129335 100644 --- a/WebContent/VAADIN/themes/valo/fonts/_fonts.scss +++ b/WebContent/VAADIN/themes/valo/fonts/_fonts.scss @@ -29,7 +29,6 @@ $fontawesome-pathPrefix: null; -moz-osx-font-smoothing: grayscale; display: inline-block; text-align: center; - @include user-select(none); } } diff --git a/WebContent/VAADIN/themes/valo/shared/_global.scss b/WebContent/VAADIN/themes/valo/shared/_global.scss index 7b7e63489a..5c010c128d 100644 --- a/WebContent/VAADIN/themes/valo/shared/_global.scss +++ b/WebContent/VAADIN/themes/valo/shared/_global.scss @@ -35,6 +35,24 @@ $valo-global-included: false !default; -webkit-text-size-adjust: 100%; -ms-text-size-adjust: 100%; -webkit-text-size-adjust: 100%; + + // Disable text selection by default + @include user-select(none); + + // Enable text selection for certain elements + input[type="text"], + .v-slot > .v-caption, + .v-gridlayout-slot > .v-caption, + .v-has-caption > .v-caption, + .v-formlayout-captioncell > .v-caption, + .v-csslayout > .v-caption { + @include user-select(text); + } + + // Removes clear button from input fields introduced by IE10 + input::-ms-clear { + display: none; + } } .v-ui { @@ -56,11 +74,6 @@ $valo-global-included: false !default; height: 0; } - // Removes clear button from input fields introduced by IE10 - input::-ms-clear { - display: none; - } - .v-drag-element { z-index: 60000; // Override any other position properties @@ -105,6 +118,7 @@ $valo-global-included: false !default; .v-icon { cursor: inherit; + @include user-select(none); } .v-icon, diff --git a/WebContent/VAADIN/themes/valo/util/_util.scss b/WebContent/VAADIN/themes/valo/util/_util.scss index a510695560..1f983c0dad 100644 --- a/WebContent/VAADIN/themes/valo/util/_util.scss +++ b/WebContent/VAADIN/themes/valo/util/_util.scss @@ -20,7 +20,6 @@ @mixin valo-tappable { - @include user-select(none); -webkit-tap-highlight-color: rgba(0,0,0,0); -webkit-touch-callout: none; cursor: pointer; -- 2.39.5