Skip to content

fix(menu): drill-in disabled menu item chevron #2199

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

Merged
merged 1 commit into from
Oct 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 29 additions & 28 deletions components/menu/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -512,34 +512,6 @@ governing permissions and limitations under the License.
}
}

.spectrum-Menu-item.is-disabled,
.spectrum-Menu-item[aria-disabled="true"] {
background-color: transparent;

.spectrum-Menu-itemLabel,
.spectrum-Menu-sectionHeading {
color: var(--highcontrast-menu-item-color-disabled, var(--mod-menu-item-label-content-color-disabled, var(--spectrum-menu-item-label-content-color-disabled)));
}

.spectrum-Menu-itemDescription {
color: var(--highcontrast-menu-item-color-disabled, var(--mod-menu-item-description-color-disabled, var(--spectrum-menu-item-description-color-disabled)));
}

.spectrum-Menu-itemIcon {
fill: var(--highcontrast-menu-item-color-disabled, var(--mod-menu-item-label-icon-color-disabled, var(--spectrum-menu-item-label-icon-color-disabled)));
color: var(--highcontrast-menu-item-color-disabled, var(--mod-menu-item-label-icon-color-disabled, var(--spectrum-menu-item-label-icon-color-disabled)));
}

&:hover {
cursor: default;

.spectrum-Menu-itemIcon {
fill: var(--highcontrast-menu-item-color-disabled, var(--mod-menu-item-label-icon-color-disabled, var(--spectrum-menu-item-label-icon-color-disabled)));
color: var(--highcontrast-menu-item-color-disabled, var(--mod-menu-item-label-icon-color-disabled, var(--spectrum-menu-item-label-icon-color-disabled)));
}
}
}

.spectrum-Menu-itemIcon {
grid-area: iconArea;
align-self: start;
Expand Down Expand Up @@ -782,3 +754,32 @@ governing permissions and limitations under the License.
}
}
}

/* Disabled menu items */
.spectrum-Menu-item.is-disabled,
.spectrum-Menu-item[aria-disabled="true"] {
background-color: transparent;

.spectrum-Menu-itemLabel,
.spectrum-Menu-sectionHeading {
color: var(--highcontrast-menu-item-color-disabled, var(--mod-menu-item-label-content-color-disabled, var(--spectrum-menu-item-label-content-color-disabled)));
}

.spectrum-Menu-itemDescription {
color: var(--highcontrast-menu-item-color-disabled, var(--mod-menu-item-description-color-disabled, var(--spectrum-menu-item-description-color-disabled)));
}

.spectrum-Menu-itemIcon {
fill: var(--highcontrast-menu-item-color-disabled, var(--mod-menu-item-label-icon-color-disabled, var(--spectrum-menu-item-label-icon-color-disabled)));
color: var(--highcontrast-menu-item-color-disabled, var(--mod-menu-item-label-icon-color-disabled, var(--spectrum-menu-item-label-icon-color-disabled)));
}

&:hover {
cursor: default;

.spectrum-Menu-itemIcon {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, sorry to revive this issue, but this implementation doesn't work with our API in SWC. The chevron is implemented differently than the other icons that can be slotted into the menu item, so I think the class .spectrum-Menu-chevron would need specification for being disabled, as well, in order to receive styling. Please look here to see the difference between an icon and the chevron. The icon has disabled styling, but the chevron still doesn't.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I took a look at this and tested out added CSS with this draft PR https://github.com/adobe/spectrum-css/pull/2550/files#diff-3b8d6209262a97e225fba580d5a675267ced29e23aadabdcc2cb73332bf11d94 , but in looking at it further I'm not sure if this extra selector is something we should add on our end? Your thoughts @pfulton ? SWC seems to have diverged from how we use our CSS. On our end, the .spectrum-Menu-itemIcon class is a generic one applied to ALL menu item icons, including the workflow icon, the collapsible chevron, the drill-in chevron, and the checkmark. Can SWC also apply this class or these styles to all icons?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can't apply that class, but we can make apply CSS as is appropriate to our context if it doesn't work for CSS to apply this rule here. Ensuring the "system icons" and "consumer icons" are both covered by this styling works a bit different in our world, for sure.

Separately, I'm never sure if I'm working from latest in the CSS public documentations, but can you apply is-disabled to one of the Menu Items in this story?
image
We'd love to see CSS applying the disabled text color to that "value" content as well, here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Separately, I'm never sure if I'm working from latest in the CSS public documentations, but can you apply is-disabled to one of the Menu Items in this story? We'd love to see CSS applying the disabled text color to that "value" content as well, here.

In PR #2579 I've updated the Storybook templates with that increased coverage and have added CSS for the "value" text to use the disabled content color.

fill: var(--highcontrast-menu-item-color-disabled, var(--mod-menu-item-label-icon-color-disabled, var(--spectrum-menu-item-label-icon-color-disabled)));
color: var(--highcontrast-menu-item-color-disabled, var(--mod-menu-item-label-icon-color-disabled, var(--spectrum-menu-item-label-icon-color-disabled)));
}
}
}
7 changes: 6 additions & 1 deletion components/menu/stories/menu.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,12 @@ DrillInSubmenu.args = {
isDrillIn: true,
isOpen: true,
},
{ label: "Select and Mask..." },
{
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding this!

label: "Select and Mask...",
isDrillIn: true,
isDisabled: true,
isOpen: true,
},
{ label: "Save Selection" },
],
};
Expand Down