Skip to content

Commit f29af33

Browse files
author
Alexis Córdova
authored
fix(checkbox): Align Required Asterisk with Checkbox and Label (#4991)
1 parent 9f3c793 commit f29af33

File tree

8 files changed

+55
-6
lines changed

8 files changed

+55
-6
lines changed

RELEASENOTES.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,21 @@
11
<!-- Release notes authoring guidelines: http://keepachangelog.com/ -->
22
<!-- !!! THIS FILE IS AUTO-GENERATED !!! DO NOT EDIT THIS FILE MANUALLY !!! -->
33

4-
## Release 2.17.3 - January 27, 2022
4+
## Release 2.17.4 - January 27, 2022
55

66
## Components
77
### [Checkbox](https://www.lightningdesignsystem.com/components/checkbox)
88
#### Fixed
99
- Checkbox inputs will no longer collapse horizontally when a label with a large amount of text is used.
10+
- All elements of an individual required checkbox (asterisk, input, and label) are now properly horizontally aligned.
11+
12+
### [Welcome Mat](https://www.lightningdesignsystem.com/components/welcome-mat)
13+
#### Fixed
14+
- Centered checkboxes using the new Flexbox layout.
1015

16+
## Release 2.17.3 - January 27, 2022
17+
18+
## Components
1119
### [Combobox](https://www.lightningdesignsystem.com/components/combobox)
1220
## Fixed
1321
- Fixed spacing/alignment issue in `.slds-input_faux > span` for select-only combobox without a placeholder.

ui/components/checkbox/RELEASENOTES.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@
44

55
<!-- ## [Unreleased] -->
66

7-
## 2.17.3
7+
## 2.17.4
88

99
### Fixed
1010
- Checkbox inputs will no longer collapse horizontally when a label with a large amount of text is used.
11+
- All elements of an individual required checkbox (asterisk, input, and label) are now properly horizontally aligned.
1112

1213
## 2.17.0
1314

ui/components/checkbox/base/_index.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@
1414
* @variant
1515
*/
1616
.slds-checkbox {
17-
display: inline-block;
17+
display: inline-flex;
1818
position: relative;
1919

2020
// When changing checkbox labels to inline-flex (PR #4769), the position of the required asterisk needed to be repositioned
2121
> .slds-required {
22-
vertical-align: super;
22+
line-height: 1; // because the required symbol is text, it needs its line-height reset
2323
}
2424

2525
/**

ui/components/checkbox/base/_touch.scss

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
.slds-checkbox {
22

3+
> .slds-required {
4+
line-height: inherit;
5+
}
6+
37
.slds-checkbox_faux,
48
.slds-checkbox--faux {
59
@include square($square-tappable-x-small);
6-
flex-shrink: 0; // Contained within flex, we don't want checkbox to shrink
710
}
811

912
.slds-checkbox__label {

ui/components/checkbox/base/example.jsx

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,34 @@ export let states = [
202202
label: 'Required',
203203
element: <Required />
204204
},
205+
{
206+
id: 'required-with-long-label',
207+
label: 'Required with long label',
208+
demoStyles: 'width: 200px',
209+
storybookStyles: true,
210+
element: (
211+
<FormElement>
212+
<Checkbox label="When you wake up in the morning, it's a quarter to one, And you want to have a little fun. You brush your teeth, ch ch ch ch, ch ch ch ch. You brush your teeth, ch ch ch ch, ch ch ch ch">
213+
<abbr className="slds-required" title="required">
214+
*
215+
</abbr>
216+
</Checkbox>
217+
</FormElement>
218+
)
219+
},
220+
{
221+
id: 'required-not-form-element-long-label',
222+
label: 'Required (Not Form Element) with long label',
223+
demoStyles: 'width: 200px',
224+
storybookStyles: true,
225+
element: (
226+
<Checkbox label="When you wake up in the morning, it's a quarter to one, And you want to have a little fun. You brush your teeth, ch ch ch ch, ch ch ch ch. You brush your teeth, ch ch ch ch, ch ch ch ch">
227+
<abbr className="slds-required" title="required">
228+
*
229+
</abbr>
230+
</Checkbox>
231+
)
232+
},
205233
{
206234
id: 'required-optional-mix',
207235
label: 'Required/Optional Combination',

ui/components/form-element/base/_index.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
// Force radios and checkboxes to be on own line when there are multiples in a group
4747
.slds-radio,
4848
.slds-checkbox {
49-
display: block;
49+
display: flex;
5050
margin-top: $spacing-xx-small;
5151
}
5252
}

ui/components/welcome-mat/RELEASENOTES.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@
33
# Welcome Mat Release Notes
44

55
<!-- ## [Unreleased] -->
6+
## 2.17.4
7+
8+
### Fixed
9+
- Centered checkboxes using the new Flexbox layout.
10+
611
## 2.16.0
712

813
### Added

ui/components/welcome-mat/base/_index.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,3 +230,7 @@
230230
fill: $color-text-inverse;
231231
}
232232
}
233+
234+
.slds-welcome-mat .slds-welcome-mat__info-actions .slds-checkbox {
235+
justify-content: center;
236+
}

0 commit comments

Comments
 (0)