fix(fieldlabel): prevent required icon from appearing on its own line when wrapping#3652
Conversation
🦋 Changeset detectedLatest commit: 2c0e7ac The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
83f108e to
cbe6e81
Compare
|
🚀 Deployed on https://pr-3652--spectrum-css.netlify.app |
File metricsSummaryTotal size: 1.37 MB*
fieldlabel
* An ASCII character in UTF-8 is 8 bits or 1 byte. |
7705dba to
a0903af
Compare
a0903af to
24aa687
Compare
rise-erpelding
left a comment
There was a problem hiding this comment.
Looks good! This works in the field label story and also appears to work fine in textfield, slider, progressbar, picker, combobox, fieldgroup, and form as far as I can tell! The only recommendation I have would be to move the text-wrap: pretty so it sits with other similar style declarations instead of with the custom prop declarations.
There was a problem hiding this comment.
There are some issues with changing this to flex as noted here.
Are we sure about that sort of layout change here and preventing wrapping? This could have other negative consequences, with side label fields forced to be wider than before and if there were other elements within the label.
I'm not sure if there is a way to adjust it to fix the alignment issues mentioned and I'm wondering if the non-breaking space should still be recommended for the implementation? Since AFAIK the asterisk still needs to wrap along with the text to be inline at the end of the text.
3e1d4ac to
aa46f10
Compare
rise-erpelding
left a comment
There was a problem hiding this comment.
I think the solution with text-wrap: pretty; will work well! I think we just need to do a little cleanup on the code. 🙂
| } | ||
|
|
||
| .spectrum-FieldLabel { |
There was a problem hiding this comment.
Do we need to add this here?
There was a problem hiding this comment.
Not necessarily! I was looking to split out custom properties from rules which resulted in three separate blocks. I pulled the styles from line ~88 up into this block. Happy to rearrange as needed.
There was a problem hiding this comment.
It looks like things are currently a little out of order with how I would expect to match up with how it is with the other components. You're right that custom properties should be separate and at the top.
I think Rise was suggesting that previously a single .spectrum-FieldLabel block at the top could have the CJK and disabled lines within it. So there'd be two .spectrum-FieldLabel blocks instead of three. Then all the style declarations would go back where they were in a .spectrum-FieldLabel block, after the size and static color classes. Gosh, trying to explain where to move around code blocks via text is cumbersome 😆
There was a problem hiding this comment.
😅 I think things are in the right order now.
412082e to
c72a363
Compare
ba891dd to
91e69d1
Compare
rise-erpelding
left a comment
There was a problem hiding this comment.
Sorry, one tiny thing with that display: block removal!
91e69d1 to
a2fa5a4
Compare
a2fa5a4 to
2c0e7ac
Compare

Description
Addresses case where fieldlabel required icon could appear on its own line when wrapping by applying text-wrap: pretty; to the parent label class.
Validation steps
fieldlabelcomponent.Requiredcontrol.Labelcontrol and verify that theRequiredicon does not render on a line separate from the text when it wraps.To-do list