1 @import 'mediawiki.skin.variables.less';
2 @import 'mediawiki.mixins.less';
4 // Form input sizes, equal to OOUI at 14px base font-size
5 @size-input-binary: 1.5625em;
9 // Styling checkboxes in a way that works cross browser is a tricky problem to solve.
10 // In MediaWiki UI put a checkbox and label inside a mw-ui-checkbox div.
11 // You should give the checkbox and label matching `id` and `for` attributes, respectively.
14 // <div class="mw-ui-checkbox">
15 // <input type="checkbox" id="component-example-3">
16 // <label for="component-example-3">Standard checkbox</label>
18 // <div class="mw-ui-checkbox">
19 // <input type="checkbox" id="component-example-3-checked" checked>
20 // <label for="component-example-3-checked">Standard checked checkbox</label>
22 // <div class="mw-ui-checkbox">
23 // <input type="checkbox" id="component-example-3-disabled" disabled>
24 // <label for="component-example-3-disabled">Disabled checkbox</label>
26 // <div class="mw-ui-checkbox">
27 // <input type="checkbox" id="component-example-3-disabled-checked" disabled checked>
28 // <label for="component-example-3-disabled-checked">Disabled checked checkbox</label>
32 // Position relatively so we can make use of absolute pseudo elements
34 line-height: @size-input-binary;
35 vertical-align: middle;
38 // Reset font sizes, see T74727
40 vertical-align: middle;
46 // Ensure the invisible input takes up the required `width` & `height`
47 width: @size-input-binary;
48 height: @size-input-binary;
49 // Support: Firefox mobile to override user-agent stylesheet, see T73750
51 // Hide `input[type=checkbox]` and instead style the label that follows
52 // Support: VoiceOver. Use `opacity` so that VoiceOver can still identify the checkbox
54 // Render *on top of* the label, so that it's still clickable, see T98905
62 // Pseudo `:before` element of the label after the checkbox now looks like a checkbox
65 background-color: #fff;
66 background-origin: border-box;
67 background-position: center center;
68 background-repeat: no-repeat;
70 box-sizing: border-box;
72 // Ensure alignment of checkbox to middle of the text in long labels, see T85241
75 width: @size-input-binary;
76 height: @size-input-binary;
77 margin-top: -( @size-input-binary / 2 );
78 border-width: @border-width-base;
79 border-style: @border-style-base;
80 border-radius: @border-radius-base;
83 // Apply a checkmark on the pseudo `:before` element when the input is checked.
84 &:checked + label::before {
85 background-image: url( images/checkbox-checked.svg );
86 background-size: 90% 90%;
97 border-color: @border-color-input-binary;
98 transition-property: @transition-property-base;
99 transition-duration: @transition-duration-base;
102 // `:focus` has to come first, otherwise a specificity race with `:hover:focus` etc is necessary
103 &:focus + label::before {
104 border-color: @border-color-input-binary--focus;
105 box-shadow: @box-shadow-inset-small @box-shadow-color-progressive--focus;
106 // In Windows high contrast mode the outline becomes visible.
107 outline: @outline-base--focus;
110 &:hover + label::before {
111 border-color: @border-color-input-binary--hover;
112 cursor: @cursor-base--hover;
115 &:active + label::before {
116 background-color: @background-color-progressive--active;
117 border-color: @border-color-progressive--active;
118 box-shadow: @box-shadow-inset-small @box-shadow-color-progressive--active;
123 background-color: @background-color-input-binary--checked;
124 border-color: @border-color-input-binary--checked;
127 &:focus + label::before {
128 background-color: @background-color-input-binary--checked;
129 border-color: @border-color-input-binary--checked;
132 &:hover + label::before {
133 background-color: @background-color-progressive--hover;
134 border-color: @border-color-input-binary--hover;
137 &:active + label::before {
138 background-color: @background-color-progressive--active;
139 border-color: @border-color-progressive--active;
144 // Disabled checkboxes have a gray background.
145 &:disabled + label::before {
146 background-color: @background-color-disabled;
147 border-color: @border-color-disabled;