-
Notifications
You must be signed in to change notification settings - Fork 198
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(checkbox/group): s2 token migration, control spacing, subtle color changes #3531
base: spectrum-two
Are you sure you want to change the base?
feat(checkbox/group): s2 token migration, control spacing, subtle color changes #3531
Conversation
🦋 Changeset detectedLatest commit: f62b64e The changes in this PR will be included in the next version bump. This PR includes changesets to release 18 packages
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 |
🚀 Deployed on https://pr-3531--spectrum-css.netlify.app |
File metricsSummaryTotal size: 1.42 MB* Table reports on changes to a package's main file.
checkbox
* An ASCII character in UTF-8 is 8 bits or 1 byte. |
8a329ce
to
6ca8078
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a great start! I pointed out some of the changes that I thought were still needed to the CSS within the CSS file, but here's a quick rundown of what I think needs another look:
- Down state
- Some of the invalid default colors (emphasized colors seem to be working fine for whatever reason) - this is a (hopefully small) bugfix that I also noticed on main
- Typography use of tokens
- Updating CJK to match other components
- Probably removing some stray dist files
- There are SO many test cases covered already, but for some reason we don't have any focus, hover, or active states. I don't think there's any particular reason we've left them out as far as I know, so I'm wondering how you would feel about adding them? I think it would make catching bugs (like the bug I just mentioned above) a little easier!
As far as I can tell, I think the template.js and stories.js files for this component are fine, so probably no changes needed there!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Going through the Figma specs here are some things I noticed on the CSS:
- Checkbox layout - all of the tokens look good here except for Component size (down):
- Awhile ago we wrote up some docs for down state in feat(downstate): docs + implementation for example components #2520, at that time the down state for checkbox was migrated to S2 as well so that it could be used on that docs page. There's also a comment in that PR from SWC about the approach there not working, that's something that we probably need to take some action on and find out more about to follow up. As it in this PR, it's changed from the checkbox being just a bit smaller when active, to being really small when active, so this will probably need another look.
- Checkbox group layout - Checking the fieldgroup component, this looks good!
- Checkbox colors - this needs some work:
- The invalid/error default checked hover (screenshot below is hovered) color is the
neutral-content-color-hover
black and not thenegative-color-1000
red. I think this is a bug that exists onmain
too, not something you introduced.
- The down/active color on this same invalid default checked checkbox is also a black color and not a red color, so this would need to be updated as well.
It's a little strange that there's not a visual for the error, I wonder what's going on with that, but I think that's outside of the work of this PR 🤷♀️
- The invalid/error default checked hover (screenshot below is hovered) color is the
- Checkbox typography
- We're not using
default-font-family
in the component, should we be? - Same for
regular-font-weight
and - Also
default-font-style
, but I see TODO comments in here around L370, it might be time to start setting those styles? I'm not sure of the historical reason why they weren't before. - CJK - this looks good and works just fine! But could you revise it so that the custom properties are redefined instead of resetting the style (probably moving the whole selector up to the top with the custom property definitions)? Similar to how you did it in Illustrated Message but with line height. Nothing is wrong with the way you have it, but after analyzing our components and realizing we're doing it 3 different ways across all of them, we want to try to standardize how we do this wherever we can, I just documented this in our style guide draft.
- We're not using
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rise-erpelding the default-font-family doesn't render correctly for some reason. For component size (down) there is something in documentation describing the usage.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we have this components/checkbox/dist/index.css.map
and components/checkbox/dist/index.css
committed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wondering if these dist files for progresscircle also need to be removed.
56c6806
to
793571c
Compare
f34473b
to
cf46c2b
Compare
0a7d424
to
cf46c2b
Compare
f6bfaa1
to
988b92a
Compare
Expanding the existing themes system to support the new S2 mappings. --- Co-authored-by: castastrophe <[email protected]> Co-authored-by: Patrick Fulton <[email protected]> Co-authored-by: Cory Dransfeldt <[email protected]> Co-authored-by: Aziz Ramos <[email protected]> Co-authored-by: Josh Winn <[email protected]> Co-authored-by: Rise Erpelding <[email protected]> Co-authored-by: Marissa Huysentruyt <[email protected]> Co-authored-by: Rajdeep Chandra <[email protected]> Co-authored-by: TarunAdobe <[email protected]> Co-authored-by: Dragan Eror<[email protected]>
Expanding the existing themes system to support the new S2 mappings. --- Co-authored-by: castastrophe <[email protected]> Co-authored-by: Patrick Fulton <[email protected]> Co-authored-by: Cory Dransfeldt <[email protected]> Co-authored-by: Aziz Ramos <[email protected]> Co-authored-by: Josh Winn <[email protected]> Co-authored-by: Rise Erpelding <[email protected]> Co-authored-by: Marissa Huysentruyt <[email protected]> Co-authored-by: Rajdeep Chandra <[email protected]> Co-authored-by: TarunAdobe <[email protected]> Co-authored-by: Dragan Eror<[email protected]>
Expanding the existing themes system to support the new S2 mappings. --- Co-authored-by: castastrophe <[email protected]> Co-authored-by: Patrick Fulton <[email protected]> Co-authored-by: Cory Dransfeldt <[email protected]> Co-authored-by: Aziz Ramos <[email protected]> Co-authored-by: Josh Winn <[email protected]> Co-authored-by: Rise Erpelding <[email protected]> Co-authored-by: Marissa Huysentruyt <[email protected]> Co-authored-by: Rajdeep Chandra <[email protected]> Co-authored-by: TarunAdobe <[email protected]> Co-authored-by: Dragan Eror<[email protected]>
* feat: s2 foundations non-gray-800 colors update * add changeset
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
--- Co-authored-by: TarunAdobe <[email protected]>
--- Co-authored-by: TarunAdobe <[email protected]>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
644902d
to
f77a28f
Compare
@@ -177,8 +195,7 @@ | |||
} | |||
|
|||
&:hover { | |||
.spectrum-Checkbox-input:checked + .spectrum-Checkbox-box, | |||
.spectrum-Checkbox-box::before { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like we lost the selector for the default hover on invalid here. If you hover over the invalid unchecked checkbox, you can see the wrong border color appearing:
Also the existing comment above this section of CSS should probably say just "Invalid" instead of "Selected Invalid", as it's not just for selected.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah good eye! Thank you
components/checkbox/index.css
Outdated
@@ -408,6 +418,8 @@ | |||
|
|||
cursor: pointer; | |||
|
|||
margin-block-start: var(--spectrum-checkbox-top-to-control); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't needed here and isn't having any effect because the input is visually hidden and position absolute. It looks like this token was an updated value that should be used for the existing margin
on .spectrum-Checkbox-box
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking that we would replace the value of the existing margin property. So instead of:
margin: calc(var(--mod-checkbox-spacing, var(--spectrum-checkbox-spacing)) / 2) 0;
margin-block-start: var(--spectrum-checkbox-top-to-control);
it'd be something like
margin: var(--mod-checkbox-margin-block, var(--spectrum-checkbox-top-to-control)) 0;
Now that we have this top to control token value, it looks like we can remove the previously used --spectrum-checkbox-spacing
?
We want to make sure this value can still be customized with a mod (renamed as --mod-checkbox-margin-block
above); the previous mod --mod-checkbox-spacing
wouldn't work anymore on the top margin when both margin
and margin-block-start
are used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm noticing a couple things that need adjustment in high contrast mode.
With the addition of --spectrum-checkbox-background-color
, this needs a highcontrast variable added where it is used. To contrast with the existing CanvasText border and content color, this should be set to Canvas:
I'm seeing a few discrepancies between different combinations on hover and focus. All of the following issues appear to exist in Prod as well:
- Invalid + Unchecked and Invalid + Indeterminate should also be showing the highlight color on hover and focus, similar to the default. Just the Invalid + Checked shows it on hover currently.
- Read-only + Unchecked + Hover and Read-only + Unchecked + Keyboard Focus shouldn't be showing the highlight color
When the background of the checkbox is the Highlight color, it should be using the matching foreground pair HighlightText within it to ensure contrast in different color schemes; right now the checkmark and the indeterminate dash are using the wrong keyword "Canvas" via --spectrum-checkbox-checkmark-color
.
There's also something really weird going on with the highlight colors. I think they're being overridden and not using the system colors, as one is appearing darker than the other:
components/checkbox/index.css
Outdated
@@ -20,15 +20,16 @@ | |||
--spectrum-checkbox-checkmark-color: var(--highcontrast-checkbox-background-color-default, var(--mod-checkbox-checkmark-color, var(--spectrum-gray-50))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The pattern used on this line doesn't seem to be consistent with where we typically define the mods and highcontrast variables. This seems like a good time to clean this up.
- removes --spectrum-statuslight-semantic-accent-color from CSS - removes deprecated accent variant from template and tests - adds changeset - update metadata.json
* feat(icon): updated s2 icons - workflow and ui Uses and updates to the latest icon sets for S2. ==== Workflow icons ==== Uses the latest version of this package. There is a large difference between the set of icons available for S1 and S2. These differences are documented separately from this work. ==== UI icons ==== Updates the ui-icons package with the latest set of icons. This includes deprecations and some new icons. See the change log for a full list of changes. The UI icons no longer contain both a medium and a large SVG asset. The file structure and loading have been changed to use the single asset. Co-authored-by: [ Cassondra ] <[email protected]> Also includes: * build(storybook): use latest 4.0.0 version of workflow icons * feat(icon): remove guessing of icon set if not provided * refactor(icon): refactors, cleans up, and documents template logic and utilities * feat(icon): exclude new ui icons not yet ready for production (CSS-1115) * feat(icon): exclude 22x20 workflow icons (CSS-1116)
/* WHCM settings */ | ||
.spectrum-Checkbox-box, | ||
.spectrum-Checkbox-input:checked + .spectrum-Checkbox-box, | ||
&.is-indeterminate .spectrum-Checkbox-input:checked + .spectrum-Checkbox-box, | ||
&.is-indeterminate .spectrum-Checkbox-box { | ||
&::before { | ||
border-color: var(--highcontrast-checkbox-color-default); | ||
} | ||
} | ||
|
||
&:hover { | ||
.spectrum-Checkbox-box::before, | ||
.spectrum-Checkbox-input:checked + .spectrum-Checkbox-box::before { | ||
border-color: var(--highcontrast-checkbox-color-default); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
High contrast only styles should live in the forced-colors media query.
Also could these possibly be handled by changes to custom property values instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
components/checkbox/index.css
Outdated
@@ -408,6 +418,8 @@ | |||
|
|||
cursor: pointer; | |||
|
|||
margin-block-start: var(--spectrum-checkbox-top-to-control); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking that we would replace the value of the existing margin property. So instead of:
margin: calc(var(--mod-checkbox-spacing, var(--spectrum-checkbox-spacing)) / 2) 0;
margin-block-start: var(--spectrum-checkbox-top-to-control);
it'd be something like
margin: var(--mod-checkbox-margin-block, var(--spectrum-checkbox-top-to-control)) 0;
Now that we have this top to control token value, it looks like we can remove the previously used --spectrum-checkbox-spacing
?
We want to make sure this value can still be customized with a mod (renamed as --mod-checkbox-margin-block
above); the previous mod --mod-checkbox-spacing
wouldn't work anymore on the top margin when both margin
and margin-block-start
are used.
{ | ||
testHeading: "Hovered", | ||
isHovered: true, | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a nice addition. I'd suggest also adding an emphasized + hovered test.
|
||
# Checkbox S2 Migration | ||
|
||
Checkbox has some new control and color tokens. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add some elaboration here about the changes? Such as the removal of .spectrum-Checkbox--sizeM
as medium is the default, high contrast updates, maybe font changes, and anything else that would be helpful to know about what has changed? I also see the thickness mod renamed, fixing its typo.
`--spectrum-checkbox-bottom-to-text(S,M,L,XL)` | ||
`--spectrum-checkbox-top-to-control (S,M,L,XL)` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you list these full token names out individually?
…previews could overlap adjacent components (#3568)
9b6a97a
to
d5e72d4
Compare
Checkbox/Group S2 Migrations
Checkbox has some new tokens for control and color. Most of the tokens have been updated in the global vars.
New tokens
--spectrum-component-size-width-ratio-down
--spectrum-checkbox-bottom-to-text(S,M,L,XL)
--spectrum-checkbox-top-to-control (S,M,L,XL)
--spectrum-accent-content-color-default
--spectrum-accent-content-color-hover
--spectrum-accent-content-color-down
--spectrum-accent-content-color-key-focus
Modified tokens
--spectrum-checkbox-checkmark-color
--spectrum-checkbox-invalid-color-down
--spectrum-checkbox-control-color-default
--spectrum-checkbox-control-color-hover
--spectrum-checkbox-control-color-down
--spectrum-checkbox-control-color-focus
How and where has this been tested?
Please tag yourself on the tests you've marked complete to confirm the tests have been run by someone other than the author.
Validation steps
Regression testing
Validate:
Screenshots
To-do list