 Issue 29365594:
  Issue 4633 - Default form styles  (Closed)
    
  
    Issue 29365594:
  Issue 4633 - Default form styles  (Closed) 
  | Left: | ||
| Right: | 
| OLD | NEW | 
|---|---|
| (Empty) | |
| 1 /*! | |
| 2 * This file is part of website-defaults | |
| 3 * Copyright (C) 2016 Eyeo GmbH | |
| 4 * | |
| 5 * website-defaults is free software: you can redistribute it and/or | |
| 6 * modify it under the terms of the GNU General Public License as published by | |
| 7 * the Free Software Foundation, either version 3 of the License, or | |
| 8 * (at your option) any later version. | |
| 9 * | |
| 10 * website-defaults is distributed in the hope that it will be useful, | |
| 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 13 * GNU General Public License for more details. | |
| 14 * | |
| 15 * You should have received a copy of the GNU General Public License | |
| 16 * along with website-defaults. If not, see <http://www.gnu.org/licenses/>. | |
| 17 */ | |
| 18 | |
| 19 /******************************************************************************* | |
| 20 * Forms | |
| 
juliandoucette
2017/01/10 13:40:26
TODO:
- move button styles to button.scss
- remov
 | |
| 21 ******************************************************************************* | |
| 22 * 1. Reset | |
| 23 * 2. Structure | |
| 24 * 3. Consistency | |
| 25 * 4. Fields | |
| 26 * 5. States | |
| 27 ******************************************************************************/ | |
| 28 | |
| 29 /* 1. Reset | |
| 30 ******************************************************************************/ | |
| 31 | |
| 32 /** | |
| 33 * 1. Change the font styles in all browsers (opinionated). | |
| 34 * 2. Remove the margin in Firefox and Safari. | |
| 
saroyanm
2016/12/06 18:26:54
Detail: Why exactly in Firefox and Safari ? I thin
 
juliandoucette
2016/12/07 17:31:08
Acknowledged.
This was taken from normalize.
 
juliandoucette
2017/01/10 13:40:27
will-do.
 | |
| 35 */ | |
| 36 | |
| 37 button, | |
| 38 input, | |
| 39 optgroup, | |
| 
saroyanm
2016/12/06 18:26:54
Why do we apply this styles to the optgroup ? Ex.
 
juliandoucette
2016/12/07 17:31:09
Acknowledged.
Don't know. This was taken from nor
 | |
| 40 select, | |
| 41 textarea | |
| 42 { | |
| 43 margin: 0; /* 2 */ | |
| 
saroyanm
2016/12/06 18:26:54
Detail: please specify units where possible.
 
saroyanm
2016/12/06 18:26:54
I don't think that we need to be that specific reg
 
juliandoucette
2016/12/07 17:31:08
Acknowledged.
Will-do.
Again, taken from normali
 | |
| 44 font-family: sans-serif; /* 1 */ | |
| 45 font-size: 100%; /* 1 */ | |
| 
saroyanm
2016/12/06 18:26:54
Deatail: I think you want to specify 1em here ?
 
juliandoucette
2016/12/07 17:31:09
Acknowledged.
Maybe. I'll investigate. I think no
 
juliandoucette
2017/01/10 13:40:27
Note: Will change this to em instead of %
 | |
| 46 line-height: inherit; | |
| 
saroyanm
2016/12/06 18:26:53
I assume you want to setup this according to the c
 
juliandoucette
2016/12/07 17:31:09
Inherit is the default value. This is a reset styl
 
juliandoucette
2017/01/10 13:40:26
Acknowledged, will investigate, and determine if w
 | |
| 47 } | |
| 48 | |
| 49 /** | |
| 50 * Make advanced text fields consistent and stylable on chrome, safari, and iOS | |
| 51 */ | |
| 52 | |
| 53 input[type="date"], | |
| 
saroyanm
2016/12/06 18:26:54
This input types are not supported across most of
 
juliandoucette
2016/12/07 17:31:09
Acknowledged.
- They are supported by HTML5
- The
 
juliandoucette
2017/01/10 13:40:27
See comment below.
 | |
| 54 input[type="time"], | |
| 55 input[type="datetime-local"], | |
| 56 input[type="month"] | |
| 57 { | |
| 58 /* stylelint-disable-next-line */ | |
| 59 -webkit-appearance: listbox; | |
| 
juliandoucette
2017/01/10 13:40:26
- will investigate if -webkit-appearance is necess
 | |
| 60 box-sizing: border-box; | |
| 61 } | |
| 62 | |
| 63 /** | |
| 64 * 1. Prevent a WebKit bug where (2) destroys native `audio` and `video` | |
| 
saroyanm
2016/12/06 18:26:53
Not really sure if I understand how this comment i
 
juliandoucette
2016/12/07 17:31:09
Apparently applying "-webkit-appearance: button" t
 | |
| 65 * controls in Android 4. | |
| 66 * 2. Correct the inability to style clickable types in iOS and Safari. | |
| 67 */ | |
| 68 | |
| 69 button, | |
| 70 html [type="button"], /* 1 */ | |
| 
saroyanm
2016/12/06 18:26:53
[type="button"] selector will be more consistent w
 
juliandoucette
2016/12/07 17:31:09
Acknowledged.
See comment above.
 | |
| 71 [type="reset"], | |
| 72 [type="submit"] | |
| 73 { | |
| 74 /* stylelint-disable-next-line */ | |
| 75 -webkit-appearance: button; /* 2 */ | |
| 
saroyanm
2016/12/06 18:26:53
I don't think why we need to use this non standard
 
juliandoucette
2016/12/07 17:31:09
Because webkit based mobile browsers apply default
 | |
| 76 } | |
| 77 | |
| 78 /** | |
| 79 * Remove the inner border and padding in Firefox. | |
| 
saroyanm
2016/12/06 18:26:54
I can't see if this have any effect on my side.
 
juliandoucette
2016/12/07 17:31:08
Acknowledged.
Looks like this is not relevant to
 | |
| 80 */ | |
| 81 | |
| 82 button::-moz-focus-inner, | |
| 83 [type="button"]::-moz-focus-inner, | |
| 84 [type="reset"]::-moz-focus-inner, | |
| 85 [type="submit"]::-moz-focus-inner | |
| 86 { | |
| 87 padding: 0; | |
| 88 border-style: none; | |
| 89 } | |
| 90 | |
| 91 /** | |
| 92 * Restore the focus styles unset by the previous rule. | |
| 
saroyanm
2016/12/06 18:26:54
Again: why do we need this non standard reset ?
Al
 
juliandoucette
2016/12/07 17:31:08
Acknowledged.
See comment above.
 | |
| 93 */ | |
| 94 | |
| 95 button:-moz-focusring, | |
| 96 [type="button"]:-moz-focusring, | |
| 97 [type="reset"]:-moz-focusring, | |
| 98 [type="submit"]:-moz-focusring | |
| 99 { | |
| 100 outline: 1px dotted ButtonText; | |
| 101 } | |
| 102 | |
| 103 /** | |
| 104 * 2. Remove the padding in IE 10-. | |
| 
saroyanm
2016/12/06 18:26:53
I don't think that this style is specific for only
 
juliandoucette
2016/12/07 17:31:09
Acknowledged.
Again, this comes from normalize. A
 | |
| 105 */ | |
| 106 | |
| 107 [type="checkbox"], | |
| 108 [type="radio"] | |
| 109 { | |
| 110 padding: 0; /* 2 */ | |
| 111 } | |
| 112 | |
| 113 /** | |
| 114 * 1. Correct the odd appearance in Chrome and Safari. | |
| 
saroyanm
2016/12/06 18:26:55
What odd appearance is this fixing, I can't see an
 
juliandoucette
2016/12/07 17:31:09
Search input has border radius by default on chrom
 | |
| 115 * 2. Correct the outline style in Safari. | |
| 116 */ | |
| 117 | |
| 118 [type="search"] | |
| 119 { | |
| 120 /* stylelint-disable-next-line */ | |
| 121 -webkit-appearance: textfield; /* 1 */ | |
| 122 outline-offset: -2px; /* 2 */ | |
| 123 } | |
| 124 | |
| 125 /** | |
| 126 * Work around a Firefox/IE bug where the transparent `button` background | |
| 127 * results in a loss of the default `button` focus styles. | |
| 128 */ | |
| 129 | |
| 130 button:focus | |
| 131 { | |
| 132 outline: 1px dotted; | |
| 133 /* stylelint-disable-next-line */ | |
| 134 outline: 5px auto -webkit-focus-ring-color; | |
| 
saroyanm
2016/12/06 18:26:54
I don't think that we want to use a webkit specifi
 
juliandoucette
2016/12/07 17:31:08
Acknowledged.
This is restoring the default behav
 
juliandoucette
2017/01/10 13:40:27
Agreed. Let's use a non-webkit color.
 | |
| 135 } | |
| 136 | |
| 137 /** | |
| 138 * Add the correct display in IE 10-. | |
| 139 */ | |
| 140 | |
| 141 [hidden] | |
| 
saroyanm
2016/12/06 18:26:53
Are we planing to use hidden attribute ?
I can't s
 
juliandoucette
2016/12/07 17:31:08
It's common to use this attribute to hide custom f
 | |
| 142 { | |
| 143 display: none; | |
| 144 } | |
| 145 | |
| 146 /* 2. Structure | |
| 147 ******************************************************************************/ | |
| 148 | |
| 149 fieldset { | |
| 
saroyanm
2016/12/06 18:26:54
Detail: the opening braces should go to the next l
 
juliandoucette
2016/12/07 17:31:08
Acknowledged.
(Sorry)
 | |
| 150 display: block; | |
| 151 /* undo browser default */ | |
| 152 margin: 0em; | |
| 153 padding: 0em; | |
| 154 border: 0em; | |
| 155 } | |
| 156 | |
| 157 legend { | |
| 158 display: block; | |
| 159 margin: 2em 0em 0em 0em; | |
| 160 /* undo browser default */ | |
| 161 padding: 0em; | |
| 162 font-size: 1.25em; | |
| 163 font-weight: $bold-weight; | |
| 164 /* undo browser default */ | |
| 165 line-height: inherit; | |
| 
saroyanm
2016/12/06 18:26:53
deatail: As far as I remember we decided to specif
 
juliandoucette
2016/12/07 17:31:08
Acknowledged.
The intention here was to unset bro
 | |
| 166 } | |
| 167 | |
| 168 label { | |
| 169 display: block; | |
| 170 margin: 1em 0em 0.25em 0em; | |
| 171 } | |
| 172 | |
| 173 /* 3. Consistency | |
| 174 ******************************************************************************* *********/ | |
| 175 | |
| 176 [type="text"], | |
| 177 [type="search"], | |
| 178 [type="tel"], | |
| 179 [type="url"], | |
| 180 [type="email"], | |
| 181 [type="password"], | |
| 182 [type="date"], | |
| 
saroyanm
2016/12/06 18:26:54
Some of this input type, like date and time are no
 
juliandoucette
2016/12/07 17:31:08
Acknowledged.
I got this list from the HTML5 spec
 
juliandoucette
2017/01/10 13:40:26
See comment above.
 | |
| 183 [type="time"], | |
| 184 [type="number"], | |
| 185 select, | |
| 186 textarea | |
| 187 { | |
| 188 width: 100%; | |
| 189 border: 1px solid $secondary; | |
| 190 background-color: $primary-light; | |
| 191 } | |
| 192 | |
| 193 [type="text"], | |
| 194 [type="search"], | |
| 195 [type="tel"], | |
| 196 [type="url"], | |
| 197 [type="email"], | |
| 198 [type="password"], | |
| 199 [type="date"], | |
| 200 [type="time"], | |
| 201 [type="number"], | |
| 202 select | |
| 203 { | |
| 204 height: 1.75em; | |
| 205 padding: 0 0.25em; | |
| 206 } | |
| 207 | |
| 208 /* 4. Fields | |
| 209 ******************************************************************************* *********/ | |
| 210 | |
| 211 textarea | |
| 212 { | |
| 213 /* Progressively disable horizontal resizing */ | |
| 214 /* stylelint-disable-next-line no-unsupported-browser-features */ | |
| 215 resize: vertical; | |
| 216 overflow: auto; | |
| 
saroyanm
2016/12/06 18:26:53
Why we need to setup overflow to auto ?
 
juliandoucette
2016/12/07 17:31:08
Acknowledged.
I don't know :/ . Will investigate.
 | |
| 217 } | |
| 218 | |
| 219 select | |
| 220 { | |
| 221 /* stylelint-disable */ | |
| 222 /* Undo chrome default border radius */ | |
| 223 -webkit-appearance: none; | |
| 
saroyanm
2016/12/06 18:26:54
The way we are designing select boxes are not reli
 
juliandoucette
2016/12/07 17:31:09
I styled select this way to specifically address t
 | |
| 224 -moz-appearance: none; | |
| 225 border-radius: 0; | |
| 226 /* Make the caret consistent across modern browsers */ | |
| 227 background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2 000/svg' version='1.1' width='32' height='24' viewBox='0 0 32 24'><polygon point s='0,0 32,0 16,24' style='fill: rgb%28138, 138, 138%29'></polygon></svg>"); | |
| 
saroyanm
2016/12/06 18:26:54
I think we can use PNG and made a wider support.
 
juliandoucette
2016/12/07 17:31:09
SVG is smaller and supports highDPI. We cannot rep
 
juliandoucette
2017/01/10 13:40:27
- will double check double backgrounds
- will doub
 | |
| 228 background-size: 9px 6px; | |
| 
saroyanm
2016/12/06 18:26:54
I think we can use background shorthand property.
 
juliandoucette
2016/12/07 17:31:09
Maybe. This may affect browser support.
 | |
| 229 background-position: right 8px center; | |
| 230 background-repeat: no-repeat; | |
| 231 padding-right: 25px; | |
| 
saroyanm
2016/12/06 18:26:54
I thought we awere planing to use EMs instead.
 
juliandoucette
2016/12/07 17:31:09
The padding-right is in px because the caret icon
 | |
| 232 /* stylelint-enable */ | |
| 233 } | |
| 234 | |
| 235 [dir="rtl"] select | |
| 236 { | |
| 237 padding-right: 25px; | |
| 
saroyanm
2016/12/06 18:26:54
You already setup padding right above.
 
juliandoucette
2016/12/07 17:31:08
Acknowledged.
Maybe I got this backwards :/
 
juliandoucette
2017/01/10 13:40:26
Verified. I got this backwards.
 | |
| 238 padding-left: 0.25em; | |
| 239 background-position: left 8px center; | |
| 240 } | |
| 241 | |
| 242 /* stylelint-disable-next-line */ | |
| 243 [type="checkbox"], | |
| 244 [type="radio"] | |
| 245 { | |
| 246 margin-right: 0.15em; | |
| 
saroyanm
2016/12/06 18:26:53
What if the label will be before the checkbox ? 
E
 
juliandoucette
2016/12/07 17:31:08
Acknowledged.
Good point.
 | |
| 247 } | |
| 248 | |
| 249 [type="button"], | |
| 250 [type="reset"] | |
| 251 { | |
| 252 @extend .button; | |
| 
saroyanm
2016/12/06 18:26:54
I'll suggest not to use @extend if there is no rea
 
juliandoucette
2016/12/07 17:31:09
Acknowledged.
 
juliandoucette
2017/01/10 13:40:26
We will move button styles to button.scss
 | |
| 253 } | |
| 254 | |
| 255 [type="submit"] | |
| 256 { | |
| 257 @extend .button; | |
| 258 @extend .submit; | |
| 259 } | |
| 260 | |
| 261 /* 5. States | |
| 262 ******************************************************************************* *********/ | |
| 263 | |
| 264 .invalid | |
| 265 { | |
| 266 color: $error; | |
| 267 } | |
| 268 | |
| 269 .invalid input, | |
| 270 .invalid textarea, | |
| 271 .invalid select | |
| 272 { | |
| 273 border-color: $error; | |
| 274 } | |
| 275 | |
| 276 .disabled | |
| 277 { | |
| 278 color: $secondary; | |
| 279 } | |
| 280 | |
| 281 .disabled input, | |
| 
saroyanm
2016/12/06 18:26:54
Why not to use disabled attribute ?
 
juliandoucette
2016/12/07 17:31:08
Because this class is intended to apply to the par
 
juliandoucette
2017/01/10 13:40:26
- Will use attribute here instead
 | |
| 282 .disabled textarea, | |
| 283 .disabled select | |
| 284 { | |
| 285 background-color: $secondary-light; | |
| 286 /* Progressively set disabled cursor */ | |
| 287 /* stylelint-disable-next-line */ | |
| 288 cursor: not-allowed; | |
| 289 } | |
| OLD | NEW |