Skip to content
Open
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
7 changes: 7 additions & 0 deletions change/@fluentui-react-menu-hc-hover-18832.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
Comment thread
mainframev marked this conversation as resolved.
"type": "patch",
"comment": "fix: use Highlight/HighlightText for MenuItem hover and open-submenu states in forced colors mode",
"packageName": "@fluentui/react-menu",
"email": "vgenaev@gmail.com",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ export const menuItemClassNames: SlotClassNames<MenuItemSlots> = {
subText: 'fui-MenuItem__subText',
};

const slotsSelector = `& .${menuItemClassNames.icon}, & .${menuItemClassNames.checkmark}, & .${menuItemClassNames.subText}, & .${menuItemClassNames.secondaryContent}`;

const useRootBaseStyles = makeResetStyles({
borderRadius: tokens.borderRadiusMedium,
position: 'relative',
Expand Down Expand Up @@ -69,9 +71,13 @@ const useRootBaseStyles = makeResetStyles({
// High contrast styles
'@media (forced-colors: active)': {
':hover': {
backgroundColor: 'Canvas',
borderColor: 'Highlight',
color: 'Highlight',
forcedColorAdjust: 'none',
backgroundColor: 'Highlight',
color: 'HighlightText',

[slotsSelector]: {
color: 'HighlightText',
},
},
...createFocusOutlineStyle({ style: { outlineColor: 'Highlight' } }),
},
Expand Down Expand Up @@ -166,8 +172,13 @@ const useStyles = makeStyles({
},

'@media (forced-colors: active)': {
backgroundColor: 'Canvas',
color: 'Highlight',
forcedColorAdjust: 'none',
backgroundColor: 'Highlight',
color: 'HighlightText',

[slotsSelector]: {
color: 'HighlightText',
},
},
},
disabled: {
Expand Down Expand Up @@ -206,13 +217,14 @@ const useStyles = makeStyles({
'@media (forced-colors: active)': {
color: 'GrayText',
':hover': {
forcedColorAdjust: 'auto',
color: 'GrayText',
backgroundColor: 'Canvas',
[`& .${menuItemClassNames.icon}`]: {
color: 'GrayText',
backgroundColor: 'Canvas',
},
[`& .${menuItemClassNames.subText}`]: {
[slotsSelector]: {
color: 'GrayText',
},
},
Expand Down
Loading