Skip to content

Commit 02bb56e

Browse files
MapTo0ilhan007
authored andcommitted
fix(ui5-checkbox): fixes issues with focus outline and wrapping (#238)
1 parent 912f434 commit 02bb56e

File tree

2 files changed

+27
-4
lines changed

2 files changed

+27
-4
lines changed

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

+24-3
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,16 @@
2222
@_ui5_checkbox_checkmark_warning_color: darken(@sapUiFieldWarningColor, 100);
2323
@_ui5_checkbox_checkmark_color: @sapUiSelected;
2424
@_ui5_checkbox_focus_left_top_bottom_position: .6875rem;
25-
@_ui5_checkbox_compact_no_label_focus_right: 0px;
25+
@_ui5_checkbox_compact_no_label_focus_right: 1px;
2626
@_ui5_checkbox_no_label_focus_right: .6875rem;
2727
@_ui5_checkbox_focus_outline: 1px dotted @sapUiContentFocusColor;
2828
@_ui5_checkbox_compact_inner_size: 1rem;
2929
@_ui5_checkbox_compact_focus_left_top_bottom_position: .375rem;
3030
@_ui5_checkbox_wrapped_content_margin_top: 0.125rem;
3131
@_ui5_checkbox_wrapped_focus_padding: .375rem;
32+
@_ui5_checkbox_wrapped_focus_left_top_bottom_position: .5625rem;
33+
@_ui5_checkbox_compact_wrapped_focus_left_top_bottom_position: .4375rem;
34+
@_ui5_checkbox_compact_wrapped_label_margin_top: -1px;
3235

3336
:host(ui5-checkbox) {
3437
display: inline-block;
@@ -75,6 +78,10 @@ ui5-checkbox {
7578
margin-top: @_ui5_checkbox_wrapped_content_margin_top;
7679
}
7780

81+
.sapUiSizeCompact .ui5-checkbox-wrapper.ui5-checkbox-with-label.ui5-checkbox--wrap .ui5-checkbox-label {
82+
margin-top: @_ui5_checkbox_compact_wrapped_label_margin_top;
83+
}
84+
7885
.ui5-checkbox--disabled {
7986
opacity: .5;
8087
}
@@ -132,7 +139,11 @@ ui5-checkbox {
132139
border: @_ui5_checkbox_focus_outline;
133140
}
134141

135-
.ui5-checkbox-wrapper:not(.ui5-checkbox-with-label):focus::after {
142+
.ui5-checkbox-wrapper.ui5-checkbox--wrap:focus::before {
143+
bottom: @_ui5_checkbox_wrapped_focus_left_top_bottom_position;
144+
}
145+
146+
.ui5-checkbox-wrapper:not(.ui5-checkbox-with-label):focus::before {
136147
right: @_ui5_checkbox_no_label_focus_right;
137148
}
138149

@@ -181,6 +192,7 @@ ui5-checkbox {
181192
}
182193

183194
.ui5-checkbox-wrapper .ui5-checkbox-label {
195+
width: calc(100% - .8125rem - @_ui5_checkbox_inner_width_height);
184196
margin-left: .8125rem;
185197
cursor: default;
186198
pointer-events: none;
@@ -211,7 +223,7 @@ ui5-checkbox {
211223
border: @_ui5_checkbox_focus_outline;
212224
}
213225

214-
.sapUiSizeCompact .ui5-checkbox-wrapper:not(.ui5-checkbox-with-label):focus::after {
226+
.sapUiSizeCompact .ui5-checkbox-wrapper:not(.ui5-checkbox-with-label):focus::before {
215227
right: @_ui5_checkbox_compact_no_label_focus_right;
216228
}
217229

@@ -221,6 +233,15 @@ ui5-checkbox {
221233
padding-bottom: @_ui5_checkbox_wrapped_focus_padding;
222234
}
223235

236+
.sapUiSizeCompact .ui5-checkbox-wrapper.ui5-checkbox--wrap:focus::before {
237+
bottom: @_ui5_checkbox_compact_wrapped_focus_left_top_bottom_position;
238+
}
239+
240+
.sapUiSizeCompact .ui5-checkbox-wrapper .ui5-checkbox-label {
241+
width: calc(100% - .8125rem - @_ui5_checkbox_compact_inner_size);
242+
}
243+
244+
224245
span[dir="rtl"] .ui5-checkbox-wrapper .ui5-checkbox-label {
225246
margin-left: 0;
226247
margin-right: .8125rem;

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

+3-1
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,6 @@
2323
@_ui5_checkbox_inner_border_radius: .125rem;
2424
@_ui5_checkbox_compact_no_label_focus_right: 1px;
2525
@_ui5_checkbox_wrapped_focus_padding: .5rem;
26-
@_ui5_checkbox_inner_readonly_border: 1px solid @sapUiFieldReadOnlyBorderColor;
26+
@_ui5_checkbox_inner_readonly_border: 1px solid @sapUiFieldReadOnlyBorderColor;
27+
@_ui5_checkbox_compact_wrapped_label_margin_top: -0.125rem;
28+
@_ui5_checkbox_compact_wrapped_focus_left_top_bottom_position: .625rem;

0 commit comments

Comments
 (0)