-
Notifications
You must be signed in to change notification settings - Fork 207
feat(action-menu): S2 migration [CSS-1160] #4085
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?
feat(action-menu): S2 migration [CSS-1160] #4085
Conversation
📚 Branch previewPR #4085 has been deployed to Azure Blob Storage: https://spectrumcss.z13.web.core.windows.net/pr-4085/index.html. |
File metricsSummaryTotal size: 1.43 MB* Table reports on changes to a package's main file. Other changes can be found in the collapsed Details section below.
File change detailsactionbutton
actiongroup
actionmenu
menu
* An ASCII character in UTF-8 is 8 bits or 1 byte. |
2729f84
to
779e411
Compare
|
635f709
to
242929c
Compare
4baa099
to
eb8cde2
Compare
313ee43
to
3babcfa
Compare
4d618da
to
f3fa4d4
Compare
f2ef53c
to
409436c
Compare
dbd613f
to
00038a9
Compare
ddb17a8
to
a3c19d7
Compare
96a7093
to
d1e6569
Compare
d1e6569
to
1ddcb45
Compare
@@ -23,6 +23,7 @@ export const CoachContainer = ( | |||
currentStep = 2, | |||
totalStepCount = 8, | |||
isOpen = false, | |||
alt = "", |
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.
Fixing an a11y feedback note from Chromatic.
})} | ||
> | ||
<img | ||
class="${rootClass}-image" | ||
src="${imageSource || "example-card-landscape.png"}" | ||
alt="${alt}" |
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.
Everything besides this is an auto-linting fix
@@ -1,7 +1,20 @@ | |||
import { Template as Menu } from "@spectrum-css/menu/stories/template.js"; | |||
import { Sizes, withDownStateDimensionCapture } from "@spectrum-css/preview/decorators"; | |||
import { |
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.
All updates here are linting fixes.
@@ -39,6 +39,7 @@ export const Template = ({ | |||
fill, | |||
id = getRandomId("icon"), | |||
customClasses = [], | |||
customStyles = {}, |
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 saw a regression in the icon VRTs where the fill was inheriting to all icons due to the custom property's inheritance.
@@ -78,15 +78,12 @@ export default { | |||
labelledby: { table: { disable: true } }, | |||
items: { table: { disable: true } }, | |||
role: { table: { disable: true } }, | |||
subrole: { table: { disable: 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.
Subrole ended up being easier to intuit from the role instead of passing it through from the parent.
)} | ||
</ul> | ||
`, | ||
Template: ({ |
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.
Letting the template handle this logic because it's a bit duplicative to redefine it here and could lead to mismatches.
@@ -133,14 +127,14 @@ export const MenuItemGroup = Variants({ | |||
{ | |||
testHeading: "No selection, with thumbnails", | |||
description: undefined, | |||
thumbnailUrl: "thumbnail.png" | |||
hasThumbnail: 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.
Since thumbnail.png is the default, just the hasThumbnail is sufficient.
@@ -37,27 +41,38 @@ const Label = ({ | |||
isCollapsible = false, | |||
label, | |||
rootClass, | |||
role, |
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.
Labels can have roles too! 🥳
return html` | ||
<span | ||
role=${ifDefined(role)} | ||
id=${ifDefined(id)} |
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.
Need the id and role for switch labels.
@@ -258,6 +274,7 @@ export const MenuItem = ( | |||
hasExternalLink = false, | |||
hasActions = false, | |||
id = getRandomId("menuitem"), | |||
labelId = getRandomId("menuitem-label"), |
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.
label id lets us connect the switch input field with the already present label for the menu item
1ddcb45
to
4a2cfe1
Compare
Description
This branch migrates the action menu component by introducing a new set of custom styles for it when previously none existed. The migration includes updates to its nested components to align with the latest design standards.
The action menu is a composite component that combines an action button with a popover and a menu.
This migration introduces several key improvements:
Action menu
--spectrum-actionmenu-button-to-menu-gap
..spectrum-ActionMenu
,.spectrum-ActionMenu-trigger
,.spectrum-ActionMenu-popover
,.spectrum-ActionMenu-menu
.Action button
hasLongPress
parameter for better control over icon display and to ensure correct aria attributes were in place.Icon system
customStyles
parameter and better integration betweenfill
property and custom styles.Menu component
The component now follows modern S2 patterns while maintaining backward compatibility and significantly improving the overall user experience and developer experience.
Motivation and context
The action menu component now has its own stylesheet with S2 design tokens and component architecture. This migration ensures consistency with other migrated components and provides improved accessibility, better positioning options, and enhanced visual design.
Related issue(s)
Screenshots (coming soon)
Author's checklist
Reviewer's checklist
patch
,minor
, ormajor
featuresManual review test cases
Action menu positioning and alignment
Icon and label customization
Menu state management
S2 token integration
--spectrum-actionmenu-button-to-menu-gap
and spacing tokensComponent structure validation
Device review