Skip to content
Open
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
28 changes: 28 additions & 0 deletions packages/mui-material/src/styles/enhanceHighContrast.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import alertClasses from '../Alert/alertClasses';
import accordionSummaryClasses from '../AccordionSummary/accordionSummaryClasses';
import autocompleteClasses from '../Autocomplete/autocompleteClasses';
import checkboxClasses from '../Checkbox/checkboxClasses';
Expand Down Expand Up @@ -115,6 +116,33 @@ export default function enhanceHighContrast<
const c = theme.components;
theme.components = {
...c,
MuiAlert: {
...c?.MuiAlert,
styleOverrides: {
...c?.MuiAlert?.styleOverrides,
root: [
c?.MuiAlert?.styleOverrides?.root,
{
// All variants lack a visible border in HCM — add one so the
// alert region is distinguishable from the surrounding canvas.
[HCM]: {
outline: `1px solid ${hcTokens.buttonBorder}`,
},
// The filled variant uses background colour to convey severity;
// in HCM backgrounds are overridden by the OS, so explicitly set
// foreground/background using system color tokens to preserve contrast.
[`&.${alertClasses.filled}`]: {
[HCM]: {
forcedColorAdjust: 'none',

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this enough? filled alert styles also define color/backgroundColor

outline: `2px solid ${hcTokens.buttonBorder}`,
color: hcTokens.buttonText,
backgroundColor: hcTokens.activeBackground,
},
},
},
],
},
},
MuiAccordionSummary: {
...c?.MuiAccordionSummary,
styleOverrides: {
Expand Down
Loading