Skip to content

Commit

Permalink
fix(menu): fix css for disabled "value" slots in menu items (#4113)
Browse files Browse the repository at this point in the history
* chore: add stories for menu items with value slot

* fix(menu): add css for disabled menu item value slot

* ci: update hash

* ci: update hash

---------

Co-authored-by: Najika Yoo <naj.halsema@gmail.com>
  • Loading branch information
najikahalsema and Najika Yoo committed Mar 1, 2024
1 parent 7c32867 commit 3c5855d
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
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
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
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>
`;
};

0 comments on commit 3c5855d

Please sign in to comment.