Normalize `input[type="search"]`
[lhc/web/wiklou.git] / resources / src / mediawiki.ui / components / inputs.less
1 // Inputs
2
3 @import "mediawiki.mixins";
4 @import "mediawiki.ui/variables";
5 @import "mediawiki.ui/mixins";
6
7 // Placeholder text styling helper
8 .field-placeholder-styling() {
9 font-style: italic;
10 font-weight: normal;
11 }
12 // Text inputs
13 //
14 // Apply the mw-ui-input class to input and textarea fields.
15 //
16 // Styleguide 1.
17
18 // mw-ui-input
19 //
20 // Style an input using MediaWiki UI.
21 // Currently in draft status and subject to change.
22 // When focused a progressive highlight appears to the left of the field.
23 //
24 // Markup:
25 // <input class="mw-ui-input" placeholder="Enter your name">
26 // <textarea class="mw-ui-input">Text here</textarea>
27 //
28 // Styleguide 1.1.
29 .mw-ui-input {
30 .box-sizing( border-box );
31 display: block;
32 width: 100%;
33 border: 1px solid @colorFieldBorder;
34 border-radius: @borderRadius;
35 padding: 0.3em 0.3em 0.3em 0.6em;
36 font-family: inherit;
37 font-size: inherit;
38 line-height: inherit;
39 vertical-align: middle;
40
41 // Placeholder text styling must be set individually for each browser @winter
42 &::-webkit-input-placeholder { // webkit
43 .field-placeholder-styling;
44 }
45 &::-moz-placeholder { // FF 4-18
46 .field-placeholder-styling;
47 }
48 &:-moz-placeholder { // FF >= 19
49 .field-placeholder-styling;
50 }
51 &:-ms-input-placeholder { // IE >= 10
52 .field-placeholder-styling;
53 }
54
55 // Remove red outline from inputs which have required field and invalid content.
56 // This is a Firefox only issue
57 // See https://developer.mozilla.org/en-US/docs/Web/CSS/:invalid
58 // This should be above :focus so focus behaviour takes preference
59 &:invalid {
60 box-shadow: none;
61 }
62
63 &:focus {
64 box-shadow: inset 0 0 0 2px @colorProgressive;
65 // Color being used to match inset shadow, not semantic reasons
66 border-color: @colorProgressive;
67 // Remove focus glow on input[type="search"]
68 outline: 0;
69 }
70
71 &:disabled {
72 border-color: @colorGray14;
73 color: @colorGray12;
74 }
75
76 // Normalize styling for `<input type="search">`
77 &[type="search"] {
78 // Correct the odd appearance in Chrome and Safari 5
79 -webkit-appearance: textfield;
80
81 // Remove proprietary clear button in IE 10-11
82 &::-ms-clear {
83 display: none;
84 }
85
86 // Remove the inner padding and cancel buttons in Chrome on OS X and Safari on OS X
87 &::-webkit-search-cancel-button,
88 &::-webkit-search-decoration {
89 -webkit-appearance: none;
90 }
91 }
92 }
93
94 textarea.mw-ui-input {
95 min-height: 8em;
96 }
97
98 // mw-ui-input-inline
99 //
100 // Use mw-ui-input-inline with mw-ui-input in cases where you want a button to line up with the input.
101 //
102 // Markup:
103 // <input class="mw-ui-input mw-ui-input-inline">
104 // <button class="mw-ui-button mw-ui-constructive">Submit</button>
105 //
106 // Styleguide 1.2.
107 input[type="number"],
108 .mw-ui-input-inline {
109 display: inline-block;
110 width: auto;
111 }
112
113 // mw-ui-input-large
114 //
115 // Use mw-ui-input-large with mw-ui-input in cases where there are multiple inputs on a screen and you
116 // want to draw attention to one instance. For example, replying with a subject line and more text.
117 // Currently in draft status and subject to change. When used on an input field, the text is styled
118 // in a large font. When used alongside another mw-ui-input large they are pushed together to form one
119 // contiguous block.
120 //
121 // Markup:
122 // <input value="input" class="mw-ui-input mw-ui-input-large" value="input" placeholder="Enter subject">
123 // <textarea class="mw-ui-input mw-ui-input-large" placeholder="Provide additional details"></textarea>
124 //
125 // Styleguide 1.3.
126 .mw-ui-input-large {
127 margin-top: 0;
128 margin-bottom: 0;
129
130 // When two large inputs are together, we make them flush by hiding one of the borders
131 & + .mw-ui-input-large {
132 margin-top: -1px;
133 }
134 // When focusing, make the input relative to raise it above any attached inputs to unhide its borders
135 &:focus {
136 position: relative;
137 }
138 }
139
140 input.mw-ui-input-large {
141 font-size: 1.75em;
142 font-weight: bold;
143 line-height: 1.25em;
144 }