-
Notifications
You must be signed in to change notification settings - Fork 201
feat(menu): spectrum 2 migration #3686
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
base: spectrum-two
Are you sure you want to change the base?
Conversation
…ctrum-css into seckles/css-614-s2-menu
…ctrum-css into seckles/css-614-s2-menu
🦋 Changeset detectedLatest commit: a8357a3 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 |
🚀 Deployed on https://pr-3686--spectrum-css.netlify.app |
File metricsSummaryTotal size: 1.38 MB*
menu
* An ASCII character in UTF-8 is 8 bits or 1 byte. |
7e8269c
to
4ce8d19
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.
I see you have some css changes in the color slider and another component that may not be related to your PR. Maybe you want to uncommit those but overall this is amazing work from what I've seen and I learned a ton from it!!
@@ -25,12 +25,12 @@ | |||
.spectrum-ColorHandle { | |||
/* outer border as box shadow on the colorhandle */ | |||
/* TODO replace --spectrum-black-rgb with color-handle-outer-border-color when supported by RGBA */ | |||
--spectrum-colorhandle-outer-border-color: rgba(var(--spectrum-black-rgb), var(--spectrum-color-handle-outer-border-opacity)); | |||
--spectrum-colorhandle-outer-border-color: rgb(var(--spectrum-black-rgb), var(--spectrum-color-handle-outer-border-opacity)); |
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.
These are being changed by the updated Stylelint linter process on commit, so my attempt to change it back didn't stick
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.
@5t3ph use --no-verify
at the end of your commit message. That ignores the changes. This happened to me once 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.
☝️ Try this (Aziz's suggestion), hopefully that resolves it!
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 looking really fantastic! I made a lot of comments but not all of them reflect changes that need to be addressed. Here's a small rundown of the changes I think this may still need:
- The spec calls for the downstate minimum perspective but it isn't used here. Unless we're not doing that for a reason, it probably needs to be added. We're using a decorator to do this. We've implemented it with button and action button just to name a couple of examples, and I think that the documentation we have on this is pretty decent as a reference. Let me know if you need help on this! It is a little flaky and sometimes doesn't work, just to warn you.
- A couple of little nits on the Storybook controls to make them a little cleaner (and a question about which checkbox variant we want in the template).
- Another look at the top spacing for the menu item.
- Another look at the menu item key focus background and content colors, as well as the section heading color.
- The missing checkmark for the XL menu item needs to be addressed.
- When I looked at the spec, there were a couple of additions I've never seen before for the highlight badge and unavailable item, I'd recommend writing a follow-up ticket to address those.
@@ -25,12 +25,12 @@ | |||
.spectrum-ColorHandle { | |||
/* outer border as box shadow on the colorhandle */ | |||
/* TODO replace --spectrum-black-rgb with color-handle-outer-border-color when supported by RGBA */ | |||
--spectrum-colorhandle-outer-border-color: rgba(var(--spectrum-black-rgb), var(--spectrum-color-handle-outer-border-opacity)); | |||
--spectrum-colorhandle-outer-border-color: rgb(var(--spectrum-black-rgb), var(--spectrum-color-handle-outer-border-opacity)); |
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.
☝️ Try this (Aziz's suggestion), hopefully that resolves it!
|
||
In addition to other small token and minor style changes, there were several new features that were added to this version of menu, including: | ||
|
||
- A thumbnail can now be added instead of an icon |
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.
Sort of a nit, but initially I read this and interpreted it as "now we use thumbnails instead of icons" which obviously isn't how it works. I get what you mean now though and would leave the decision to clarify up to you.
Silly English language.
|
||
- A thumbnail can now be added instead of an icon | ||
- A section description can now be included below the menu section heading | ||
- The actions area previously held action switches for multi-select, and in this version, an external link action icon can be included in that area |
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 as good a spot as any for me to say that I noticed in Figma that now we have a couple of other new things that I swear I've never seen before in this spec (looking at S2 / Desktop), so I don't know when they were added, there's this unavailable icon that looks like it would be in the same position as the external link icon, and there's this highlight badge too.

I'd say let's not worry about it in this PR unless you think that's something you can add really quickly (I'm honestly not even sure what we would need to implement the badge), but let's make a follow up ticket and we can address it later on.
value: undefined, | ||
iconName: undefined, | ||
include: ["No selection", "No selection, with description", "Truncation", "Text wrapping"] | ||
} | ||
// { |
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.
Do you know what this does? It looks like it adds the .is-highlighted
class, does that correspond to ::highlight()
(which I totally just looked up and didn't know existed until today)? 🤔
Just curious! Seems like I've overlooked this many times before since it's nothing new to menu.
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.
No notes here for me on this, looks great! 💖
@@ -614,7 +644,6 @@ | |||
|
|||
.spectrum-Menu-item:focus-visible, | |||
.spectrum-Menu-back:focus-visible { | |||
box-shadow: var(--spectrum-menu-item-focus-indicator-shadow) var(--spectrum-menu-item-focus-indicator-border-width) 0 0 0 var(--spectrum-menu-item-focus-indicator-color-default); | |||
outline: var(--spectrum-menu-item-focus-indicator-width) var(--spectrum-menu-item-focus-indicator-outline-style) var(--spectrum-menu-item-focus-indicator-color-default); | |||
outline-offset: var(--spectrum-menu-item-focus-indicator-offset); | |||
border-radius: var(--spectrum-menu-item-corner-radius); |
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 wonder if there's a specific reason --spectrum-menu-item-corner-radius
doesn't have a mod, maybe it was introduced in Foundations and we accidentally overlooked it? What are your thoughts on adding one here and for .spectrum-Menu-item
?
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.
A few things that I couldn't find a place in the code to comment because they're not based on changes you've made here:
- I've been wondering about the spacing in the design spec. I noticed that the top edge to icon spacing tokens weren't used (
component-top-to-workflow-icon-100
and other sizes). Should we be using them or is that spacing accounted for in a different way? I think right now what you've got for the icon spacing is the padding around the menu item, which iscomponent-top-to-text-100
and its associated sizes, which ends up being just a px or so off at certain sizes. - We're also not using the
menu-item-to-items
token (for item to item spacing), but there is a 4px margin on the menu items which seems like it's there to accommodate the focus outline? This feels like it might have been something that confused me when I was working on this before; do we need extra space that isn't in the spec to ensure we have enough space for the focus outline? Should we be using the spec on top of that or in place of that? - I don't know if you can see this but the
margin-block
on the.spectrum-Menu-divider
is crossed out, I can't figure out why, but it seems to be doing the right thing anyway. 🤷♀️ I don't think this needs to be fixed, I'm just wondering why this is happening.
@@ -465,7 +487,7 @@ | |||
|
|||
&:focus, | |||
&.is-focused { | |||
background-color: var(--highcontrast-menu-item-background-color-focus, var(--mod-menu-item-background-color-key-focus, var(--spectrum-menu-item-background-color-key-focus))); | |||
background-color: var(--highcontrast-menu-item-background-color-focus, var(--mod-menu-item-background-color-key-focus, var(--spectrum-menu-item-background-color-keyboard-focus))); |
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 noticed we're missing a background color on the keyboard focused menu item and I'm wondering if the :focus
and :focus-visible
states have been being confused for one another? That might need a second look.
I think .is-focus-visible
is being applied in the template for the isFocused
arg, which feels like it also might be something we've been getting wrong for awhile unless I'm missing something?
One other issue I noticed related to this is that the focused menu items in the testing grid aren't getting the right content colors either (they get the default color instead of the focus color), because I think they might be applied specifically only to :focus
and not :focus-visible
.
@@ -127,6 +45,16 @@ | |||
--spectrum-menu-section-header-line-height-cjk: var(--spectrum-cjk-line-height-100); | |||
--spectrum-menu-section-header-font-weight: var(--spectrum-bold-font-weight); | |||
--spectrum-menu-section-header-color: var(--spectrum-gray-900); |
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 --spectrum-menu-section-header-color
, I think it's supposed to be --spectrum-neutral-content-color-default
which ends up aliasing to --spectrum-gray-800
.
--spectrum-menu-item-checkmark-height: var(--spectrum-menu-item-checkmark-height-medium); | ||
--spectrum-menu-item-checkmark-width: var(--spectrum-menu-item-checkmark-width-medium); |
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 --spectrum-menu-item-checkmark-height-medium
, --spectrum-menu-item-checkmark-width-medium
, and their associated sizes (small, large, etc.) are tokens, but it doesn't look like they're being used anymore; instead the spec says to use checkmark-icon-size-75
(and other sized friends like -100, -200, etc.).
I noticed that the checkmark is disappearing for the XL size and I'm wondering if that has something to do with it:
Description
First of all, big s/o to @rise-erpelding for the original work in #2802 🙌
S2 Menu references:
New features
Also of note is that the
grid-template-areas
forspectrum-Menu-item
were updated to accomodate the positioning of elements relative to the thumbnail.Tokens update
Since
@adobe/spectrum-tokens
has been updated to include many tokens relating to the menu component, including some that replace custom tokens that had previously been added. As such, these custom menu item color tokens that are now available from@adobe/spectrum-tokens
have been removed.One special case is
--spectrum-menu-item-background-color-default
which was spec'd to have "0% opacity" which for a CSS background color translates totransparent
so that token is redefined as such. So,menu-item-background-opacity
was not used.Additionally, due to the margin required for the focus indicator previously implemented, the "new" token
menu-item-to-item
was not implemented as it compounded that margin.New mods
--mod-menu-item-linkout-icon-height
--mod-menu-item-linkout-icon-width
--mod-menu-item-thumbnail-height
--mod-menu-item-thumbnail-opacity-disabled
--mod-menu-item-thumbnail-to-label
--mod-menu-item-thumbnail-width
--mod-menu-item-top-to-thumbnail
--mod-menu-section-description-color
--mod-menu-section-description-font-size
--mod-menu-section-description-font-weight
--mod-menu-section-description-line-height
--mod-menu-section-description-line-height-cjk
--mod-menu-section-header-to-description
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
menu-item-background-opacity
andmenu-item-to-item
as explained abovemenu-item-label-to-description
size tokenssection-header-to-description
size tokensmenu-top-to-thumbnail
size tokenstext-to-visual-400
(used for thumbnail to label inline spacing)link-out-icon
size tokensRegression testing
Validate:
Screenshots
Note: The desktop guide shows that when thumbnail is active, the selected state check or checkbox should be center aligned
To-do list