Skip to content

Commit

Permalink
fix(menu): disabled color for value text and add disabled stories (#2579
Browse files Browse the repository at this point in the history
)

- Updates two existing stories to include a disabled menu item with the
  Switch input.
- Updates disabled styles so that the value area text also appears with
  the disabled content color when the menu item is disabled. Noticed
  when updating the stories and confirmed on newer design spec.
  • Loading branch information
jawinn committed Mar 4, 2024
1 parent eac9b74 commit f0fae60
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
6 changes: 4 additions & 2 deletions components/menu/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -779,7 +779,8 @@ governing permissions and limitations under the License.
background-color: transparent;

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

Expand All @@ -797,7 +798,8 @@ governing permissions and limitations under the License.
background-color: transparent;

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

Expand Down
9 changes: 9 additions & 0 deletions components/menu/stories/menu.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,10 @@ WithActions.args = {
{
label: "Subtract",
},
{
label: "Example of a disabled menu item",
isDisabled: true,
},
],
};

Expand All @@ -348,6 +352,11 @@ WithValueAndActions.args = {
label: "Subtract",
value: "Value"
},
{
label: "Example of a disabled menu item",
value: "Value",
isDisabled: true,
},
],
};

Expand Down
4 changes: 3 additions & 1 deletion components/menu/stories/template.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { html } from "lit";
import { classMap } from "lit/directives/class-map.js";
import { styleMap } from "lit/directives/style-map.js";
import { ifDefined } from "lit/directives/if-defined.js";
import { styleMap } from "lit/directives/style-map.js";
import { when } from "lit/directives/when.js";

import { Template as Checkbox } from "@spectrum-css/checkbox/stories/template.js";
Expand Down Expand Up @@ -109,6 +109,7 @@ export const MenuItem = ({
size,
isEmphasized: true,
isChecked: isSelected,
isDisabled,
id: `menu-checkbox-${idx}`,
customClasses: [
`${rootClass}Checkbox`,
Expand Down Expand Up @@ -136,6 +137,7 @@ export const MenuItem = ({
...globals,
size,
isChecked: isSelected,
isDisabled,
label: null,
id: `menu-switch-${idx}`,
customClasses: [
Expand Down

0 comments on commit f0fae60

Please sign in to comment.