Skip to content

Commit 8ec2c71

Browse files
committed
refactor(menu): adjust styling for disabled drill-in chevron
The SWC implementation was having difficulty with making sure the chevron on a disabled drill-in menu item displayed as disabled, without overriding CSS. On the SWC end, the way a generic icon is styled is different from how chevrons or checkmarks are styled, so the styles added don't apply to the chevron. On looking at it on the CSS side, it doesn't seem to make sense to use the .spectrum-itemIcon class on the drill-in chevron, as it is not providing any styles and it seems that it should be distinct from the icon to the left of the menu item label.
1 parent 565294a commit 8ec2c71

File tree

3 files changed

+23
-14
lines changed

3 files changed

+23
-14
lines changed

components/menu/index.css

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -787,7 +787,8 @@ governing permissions and limitations under the License.
787787
color: var(--highcontrast-menu-item-color-disabled, var(--mod-menu-item-description-color-disabled, var(--spectrum-menu-item-description-color-disabled)));
788788
}
789789

790-
.spectrum-Menu-itemIcon {
790+
.spectrum-Menu-itemIcon,
791+
.spectrum-Menu-chevron {
791792
fill: var(--highcontrast-menu-item-color-disabled, var(--mod-menu-item-label-icon-color-disabled, var(--spectrum-menu-item-label-icon-color-disabled)));
792793
color: var(--highcontrast-menu-item-color-disabled, var(--mod-menu-item-label-icon-color-disabled, var(--spectrum-menu-item-label-icon-color-disabled)));
793794
}
@@ -805,7 +806,8 @@ governing permissions and limitations under the License.
805806
color: var(--highcontrast-menu-item-color-disabled, var(--mod-menu-item-description-color-disabled, var(--spectrum-menu-item-description-color-disabled)));
806807
}
807808

808-
.spectrum-Menu-itemIcon {
809+
.spectrum-Menu-itemIcon,
810+
.spectrum-Menu-chevron {
809811
fill: var(--highcontrast-menu-item-color-disabled, var(--mod-menu-item-label-icon-color-disabled, var(--spectrum-menu-item-label-icon-color-disabled)));
810812
color: var(--highcontrast-menu-item-color-disabled, var(--mod-menu-item-label-icon-color-disabled, var(--spectrum-menu-item-label-icon-color-disabled)));
811813
}

components/menu/metadata/menu.yml

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,24 @@ sections:
66
This component can be modified via its `--mod-*` prefixed custom properties. A list of those prefixed custom properties can be found <a class="spectrum-Link" href="https://github.com/adobe/spectrum-css/tree/main/components/menu/metadata/mods.md">here</a>.
77
- name: Migration Guide
88
description: |
9-
### T-shirt sizing
9+
### 1/22/2024 - Version 6.1.4
10+
The `.spectrum-itemIcon` class has been removed from the drill-in variant's chevron.
11+
12+
### 8/04/2023 - Version 6.0.0
13+
14+
#### Core tokens migration ####
15+
This component now uses Spectrum Tokens instead of DNA tokens.
16+
17+
#### T-shirt sizing
1018
Menu now supports t-shirt sizing and requires that you specify the size by adding a `.spectrum-Menu--size*` class.
1119
12-
### Use small divider classes
13-
When using a section divider, add `.spectrum-Divider` and `spectrum-Divider--sizeS` classes to `spectrum-Menu-divider`. The divider has also changed from medium to small.
20+
#### Use small divider classes
21+
When using a section divider, add `.spectrum-Divider` and `spectrum-Divider--sizeS` classes to `spectrum-Menu-divider`. The divider has changed from medium to small.
1422
15-
### Change workflow icon size to medium
16-
Please replace `.spectrum-Icon--sizeS` with `.spectrum-Icon--sizeM`.
23+
### 9/22/2020 - Version 3.0.0
1724
18-
### Menu item with switch mark up ###
19-
In the case of a menu item that includes an icon and a switch, the label and icon should be seperate elements. As opposed to the icon SVG being with in the label. This matches the pattern of other variants with icons within the menu item.
25+
#### Change workflow icon size to medium
26+
Please replace `.spectrum-Icon--sizeS` with `.spectrum-Icon--sizeM`.
2027
2128
examples:
2229
- id: sizing
@@ -619,7 +626,7 @@ examples:
619626
</ul>
620627
</li>
621628
<li class="spectrum-Menu-item spectrum-Menu-item--collapsible spectrum-Menu-item--collapsible-withWorkflowIcon" role="menuitem" tabindex="0">
622-
<svg class="spectrum-Icon spectrum-Icon--sizeS spectrum-UIIcon-ChevronRight75 spectrum-Menu-chevron spectrum-Menu-itemIcon" focusable="false" aria-hidden="true" aria-label="Next">
629+
<svg class="spectrum-Icon spectrum-Icon--sizeS spectrum-UIIcon-ChevronRight75 spectrum-Menu-chevron" focusable="false" aria-hidden="true" aria-label="Next">
623630
<use xlink:href="#spectrum-css-icon-Chevron75" />
624631
</svg>
625632
<svg class="spectrum-Icon spectrum-Icon--sizeS spectrum-Menu-itemIcon spectrum-Menu-itemIcon--workflowIcon" focusable="false" aria-hidden="true" aria-label="Watch Icon">
@@ -1228,6 +1235,7 @@ examples:
12281235
</div>
12291236
- id: with-switch
12301237
name: With Switch
1238+
description: In the case of a menu item that includes an icon and a switch, the label and icon should be seperate elements. As opposed to the icon SVG being within the label. This matches the pattern of other variants that have icons within a menu item.
12311239
markup: |
12321240
<div class="spectrum-Examples" style="justify-content: flex-start; gap: 25%;">
12331241
<div class="spectrum-Examples-item">
@@ -1329,7 +1337,7 @@ examples:
13291337
</li>
13301338
<li class="spectrum-Menu-item spectrum-Menu-item--drillIn is-open" role="menuitem" tabindex="0">
13311339
<span class="spectrum-Menu-itemLabel">Feather really long item</span>
1332-
<svg class="spectrum-Icon spectrum-Icon--sizeM spectrum-UIIcon-ChevronRight100 spectrum-Menu-chevron spectrum-Menu-itemIcon" focusable="false" aria-hidden="true" aria-label="Next">
1340+
<svg class="spectrum-Icon spectrum-Icon--sizeM spectrum-UIIcon-ChevronRight100 spectrum-Menu-chevron" focusable="false" aria-hidden="true" aria-label="Next">
13331341
<use xlink:href="#spectrum-css-icon-Chevron100" />
13341342
</svg>
13351343
</li>
@@ -1388,7 +1396,7 @@ examples:
13881396
13891397
- id: menu-truncate
13901398
name: Menu with truncating text
1391-
description: Use the class `spectrum-Menu-itemLabel--truncate` on the item label or section heading that should truncate with in a menu with a set `inline-size` or `max-inline-size`
1399+
description: Use the class `spectrum-Menu-itemLabel--truncate` on the item label or section heading that should truncate within a menu with a set `inline-size` or `max-inline-size`
13921400
markup: |
13931401
<div class="spectrum-Examples" style="justify-content: flex-start; gap: 25%;">
13941402
<div class="spectrum-Examples-item">

components/menu/stories/template.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { html } from "lit";
22
import { classMap } from "lit/directives/class-map.js";
3-
import { styleMap } from "lit/directives/style-map.js";
43
import { ifDefined } from "lit/directives/if-defined.js";
4+
import { styleMap } from "lit/directives/style-map.js";
55
import { when } from "lit/directives/when.js";
66

77
import { Template as Checkbox } from "@spectrum-css/checkbox/stories/template.js";
@@ -98,7 +98,6 @@ export const MenuItem = ({
9898
iconName: "ChevronRight100",
9999
size,
100100
customClasses: [
101-
`${rootClass}Icon`,
102101
"spectrum-Menu-chevron",
103102
],
104103
})

0 commit comments

Comments
 (0)