Skip to content

Commit 9b18490

Browse files
authored
fix(ui5-checkbox): outline appearance in Compact + RTL (#23)
Remove unnecessary css, correct the focus outline in Compact and RTL. Provide additional fix, specific to IE, that enables focusing upon text and box tap.
1 parent 36ab807 commit 9b18490

File tree

1 file changed

+24
-92
lines changed

1 file changed

+24
-92
lines changed

packages/main/src/themes/base/CheckBox.less

+24-92
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,6 @@ ui5-checkbox {
2424
max-width: 100%;
2525
}
2626

27-
ui5-checkbox[wrap] {
28-
height: auto;
29-
}
30-
3127
.sapMCb {
3228
display: flex;
3329
align-items: center;
@@ -44,6 +40,10 @@ ui5-checkbox[wrap] {
4440
pointer-events: none;
4541
}
4642

43+
&:focus {
44+
outline: none;
45+
}
46+
4747
/*
4848
* this is a hack for a bug in IE
4949
* https://github.com/philipwalton/flexbugs/issues/231
@@ -65,6 +65,7 @@ ui5-checkbox[wrap] {
6565
min-height: 1.125rem;
6666
min-width: 1.125rem;
6767
text-align: center;
68+
pointer-events: none;
6869

6970
&.sapMCbMarkChecked:before {
7071
content: "\e05b";
@@ -77,6 +78,7 @@ ui5-checkbox[wrap] {
7778
& > input {
7879
-webkit-appearance: none;
7980
visibility: hidden;
81+
width: 0;
8082
}
8183

8284
&.sapMCbMark,
@@ -89,9 +91,11 @@ ui5-checkbox[wrap] {
8991
.sapMCb.sapMCbHasLabel {
9092
padding-right: 0;
9193

92-
ui5-label {
94+
& .sapWCLabelInCheckBox {
9395
padding-left: 0.875rem;
9496
vertical-align: bottom;
97+
cursor: default;
98+
pointer-events: none;
9599
}
96100
}
97101

@@ -103,8 +107,11 @@ ui5-checkbox[wrap] {
103107
top: 0.875rem;
104108
}
105109

106-
ui5-label {
110+
.sapWCLabelInCheckBox {
107111
line-height: 3rem;
112+
overflow: hidden;
113+
align-self: center;
114+
margin: 0.675rem 0;
108115
}
109116
}
110117

@@ -149,10 +156,6 @@ ui5-checkbox[wrap] {
149156
}
150157

151158
/* CheckBox focus */
152-
.sapMCb:focus {
153-
outline: none;
154-
}
155-
156159
.sapMCbBg:focus,
157160
.sapMCbBg:active,
158161
.sap-desktop .sapMCbBg.sapMCbBgDis:focus {
@@ -201,16 +204,15 @@ ui5-checkbox[wrap] {
201204
}
202205
}
203206

204-
/* ========================== Compact ========================== */
207+
/* Compact */
205208
.sapUiSizeCompact {
206209

207210
.sapMCb {
208-
height: 2rem;
211+
min-height: 2rem;
209212
min-height: 2rem;
210213
padding: 0 .5rem;
211214
}
212215

213-
214216
.sapMCbBg {
215217
left: 0.025rem;
216218
top: 0.025rem;
@@ -224,7 +226,7 @@ ui5-checkbox[wrap] {
224226
}
225227

226228
/* ChekBox With Label */
227-
.sapMCb.sapMCbHasLabel ui5-label {
229+
.sapMCb.sapMCbHasLabel .sapWCLabelInCheckBox {
228230
padding-left: 0.5rem;
229231
vertical-align: bottom;
230232
}
@@ -234,103 +236,33 @@ ui5-checkbox[wrap] {
234236
.sapMCbBg {
235237
top: 0.5rem;
236238
}
237-
ui5-label {
239+
240+
.sapWCLabelInCheckBox {
238241
line-height: 2rem;
242+
margin: .25rem 0;
239243
}
240244
}
241245

242246
.sapMCb:not(.sapMCbBgDis).sapMCbHasLabel:focus:before {
243-
top: 0.375rem;
244-
bottom: 0.375rem;
247+
top: 0.35rem;
248+
bottom: 0.325rem;
245249
left: .375rem;
246250
}
247251
}
248252

249-
[data-sap-ui-wc-root].sap-desktop.sapUiSizeCompact {
250-
.sapMCb:not(.sapMCbBgDis).sapMCbHasLabel:focus:before {
251-
top:0.365rem;
252-
bottom: 0.365rem;
253-
left: 0.365rem;
254-
}
255-
}
256-
257-
/* ========================== RTL ========================== */
258-
:host(ui5-checkbox[dir=RTL]) {
259-
.sapMCb.sapMCbHasLabel {
260-
padding-left: 0;
261-
padding-right: 0.875rem;
262-
263-
ui5-label {
264-
padding-right: 0.875rem;
265-
padding-left: 0;
266-
}
267-
}
268-
269-
270-
.sapUiSizeCompact {
271-
.sapMCbBg {
272-
right: 0.025rem;
273-
}
274-
/* ChekBox With Label */
275-
.sapMCb.sapMCbHasLabel ui5-label {
276-
padding-left: 0.5rem;
277-
}
278-
}
279-
}
280-
281-
ui5-checkbox[dir=RTL] {
282-
.sapMCb.sapMCbHasLabel {
283-
padding-left: 0;
284-
padding-right: 0.875rem;
285-
286-
ui5-label {
287-
padding-right: 0.875rem;
288-
padding-left: 0;
289-
}
290-
}
291-
292-
.sapUiSizeCompact {
293-
.sapMCbBg {
294-
right: 0.025rem;
295-
}
296-
/* ChekBox With Label */
297-
.sapMCb.sapMCbHasLabel ui5-label {
298-
padding-left: 0.5rem;
299-
}
300-
}
301-
}
302-
303-
span[dir="rtl"] {
304-
253+
/* RTL */
254+
[dir="rtl"] {
305255
& .sapMCb:not(.sapMCbBgDis).sapMCbHasLabel:focus:before {
306256
left: 0;
307257
right: 0.675rem;
308258
}
309259

310-
&.sapUiSizeCompact {
311-
& .sapMCb:not(.sapMCbBgDis).sapMCbHasLabel:focus:before {
312-
top: .25rem;
313-
bottom: .25rem;
314-
}
315-
}
316-
317-
318260
& .sapMCb.sapMCbHasLabel {
319261
padding: 0 .875rem;
320262
padding-left: 0;
321263

322-
& ui5-label {
264+
& .sapWCLabelInCheckBox {
323265
padding: 0 .875rem 0 0;
324266
}
325267
}
326-
}
327-
328-
.sapWCLabelInCheckBox {
329-
overflow: hidden;
330-
align-self: center;
331-
cursor: default;
332-
}
333-
334-
.sapMCbWrapped .sapWCLabelInCheckBox {
335-
margin: 0.675rem 0;
336268
}

0 commit comments

Comments
 (0)