1 @import "mediawiki.mixins";
2 @import "mediawiki.ui/variables";
6 // Styling radios in a way that works cross browser is a tricky problem to solve.
7 // In MediaWiki UI put a radio and label inside a mw-ui-radio div.
8 // This renders in all browsers except IE6-8 which do not support the :checked selector;
9 // these are kept backwards-compatible using the :not(#noop) selector.
10 // You should give the radio and label matching "id" and "for" attributes, respectively.
13 // <div class="mw-ui-radio">
14 // <input type="radio" id="kss-example-4" name="kss-example-4">
15 // <label for="kss-example-4">Standard radio</label>
17 // <div class="mw-ui-radio">
18 // <input type="radio" id="kss-example-4-checked" name="kss-example-4" checked>
19 // <label for="kss-example-4-checked">Standard checked radio</label>
21 // <div class="mw-ui-radio">
22 // <input type="radio" id="kss-example-4-disabled" name="kss-example-4-disabled" disabled>
23 // <label for="kss-example-4-disabled">Disabled radio</label>
25 // <div class="mw-ui-radio">
26 // <input type="radio" id="kss-example-4-disabled-checked" name="kss-example-4-disabled" disabled checked>
27 // <label for="kss-example-4-disabled-checked">Disabled checked radio</label>
32 display: inline-block;
33 vertical-align: middle;
38 // We use the not selector to cancel out styling on IE 8 and below
39 .mw-ui-radio:not(#noop) {
40 // Position relatively so we can make use of absolute pseudo elements
42 line-height: @radioSize;
45 // reset font sizes (see bug 72727)
47 vertical-align: middle;
51 // we hide the input element as instead we will style the label that follows
52 // we use opacity so that VoiceOver software can still identify it
54 // ensure the invisible radio takes up the required width
57 // This is needed for Firefox mobile (See bug 71750 to workaround default Firefox stylesheet)
61 // the pseudo before element of the label after the radio now looks like a radio
63 .transition( 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275) );
66 .box-sizing(border-box);
72 background-color: #fff;
73 border: 1px solid @colorGray7;
74 .background-image-svg('images/radio_checked.svg', 'images/radio_checked.png');
75 .background-size( @radioSize, @radioSize );
76 background-repeat: no-repeat;
77 background-position: center center;
78 background-origin: border-box;
82 // when the input is checked, style the label pseudo before element that followed as a checked radio
83 &:checked + label::before {
84 background-size: 100% 100%;
87 &:active + label::before {
88 background-color: @colorGray13;
89 border-color: @colorGray13;
92 &:focus + label::before {
96 &:focus:hover + label::before,
97 &:hover + label::before {
98 border-bottom-width: 3px;
101 // disabled radios have a gray background
102 &:disabled + label::before {
104 background-color: @colorGray14;
105 border-color: @colorGray14;
108 // disabled and checked radios have a white circle
109 &:disabled:checked + label::before {
110 .background-image-svg('images/radio_disabled.svg', 'images/radio_disabled.png');