Skip to content
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

fix(menu): fix css for disabled "value" slots in menu items #4113

Merged
merged 4 commits into from
Mar 1, 2024
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
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ executors:
parameters:
current_golden_images_hash:
type: string
default: 2b61b82c83bc3f5e7cfff9eaf4695fc67e591aeb
default: 686fa6e78586a47ae3fd13d4171392ca5aa5d42d
wireit_cache_name:
type: string
default: wireit
Expand Down
10 changes: 10 additions & 0 deletions packages/menu/src/menu-item.css
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,16 @@ governing permissions and limitations under the License.
pointer-events: none;
}

:host([disabled]) [name='value']::slotted(*) {
color: var(
--highcontrast-menu-item-color-disabled,
var(
--mod-menu-item-label-icon-color-disabled,
var(--spectrum-menu-item-label-icon-color-disabled)
)
);
}

:host([has-submenu][disabled]) .chevron {
color: var(
--highcontrast-menu-item-color-disabled,
Expand Down
55 changes: 54 additions & 1 deletion packages/menu/stories/menu.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ export const menuItemWithDescription = (): TemplateResult => {
Open a copy
<span slot="description">Illustrator for iPad</span>
</sp-menu-item>
<sp-menu-item>
<sp-menu-item disabled>
<sp-icon-share slot="icon"></sp-icon-share>
Share link
<span slot="description">Enable comments and download</span>
Expand Down Expand Up @@ -373,3 +373,56 @@ export const MenuGroupSelectsMultiple = (): TemplateResult => {
</sp-popover>
`;
};

export const menuWithValueSlots = (): TemplateResult => {
return html`
<sp-menu style="width: 150px">
<sp-menu-item>
Undo
<span slot="value">⌘​Z</span>
</sp-menu-item>
<sp-menu-item disabled>
Redo
<span slot="value">⇧⌘​Z</span>
</sp-menu-item>
<sp-menu-divider></sp-menu-divider>
<sp-menu-item>
Cut
<span slot="value">⌘​X</span>
</sp-menu-item>
<sp-menu-item>
Copy
<span slot="value">⌘​S</span>
</sp-menu-item>
<sp-menu-item disabled>
Paste
<span slot="value">⌘​P</span>
</sp-menu-item>
</sp-menu>
<sp-popover open style="width: 150px">
<sp-menu>
<sp-menu-item>
Undo
<span slot="value">⌘​Z</span>
</sp-menu-item>
<sp-menu-item disabled>
Redo
<span slot="value">⇧⌘​Z</span>
</sp-menu-item>
<sp-menu-divider></sp-menu-divider>
<sp-menu-item>
Cut
<span slot="value">⌘​X</span>
</sp-menu-item>
<sp-menu-item>
Copy
<span slot="value">⌘​S</span>
</sp-menu-item>
<sp-menu-item disabled>
Paste
<span slot="value">⌘​P</span>
</sp-menu-item>
</sp-menu>
</sp-popover>
`;
};
Loading