-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
fix: improve color contrast in AlertBox info variant #8297
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: improve color contrast in AlertBox info variant #8297
Conversation
- Change info background from bg-info-600 to bg-info-400 - Improves text contrast ratio to meet WCAG 2.1 AA standards - Ensures better readability for users with visual impairments The darker background (info-400) provides better contrast with white text, meeting the minimum 4.5:1 contrast ratio requirement. Fixes nodejs#8290
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Please let me know if you'd prefer different shade values for better contrast or design consistency. |
|
Yup thanks for being volonture. But on our design syteme in light theme the bg should stay as it but the text should be withe. If you take a look on may branch in storybook the alertBox is correct. Is a css conflict with style from AlertBox and markdown content style. because the |
|
@AugustinMauroy like this?
|
YEAH ! |
- Keep background color at bg-info-600 as per design system - Add !important to paragraph color to override markdown styles - Fix text color conflict where p tags inherit markdown paragraph styles The issue was a CSS specificity conflict. Paragraph elements inside AlertBox were inheriting black text color from markdown styles instead of maintaining the white text color defined in AlertBox styles. Fixes nodejs#8290
…-MINJAE/nodejs.org into fix/issue-8290-alert-contrast
AugustinMauroy
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGMT !
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if the child is a span? div?
Can we use a more broad selector?
|
I'd prefer a broader selector, ie a wildcard |
|
@avivkeller Got it! |
|
Lighthouse Results
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #8297 +/- ##
=======================================
Coverage 76.61% 76.61%
=======================================
Files 117 117
Lines 9746 9751 +5
Branches 328 328
=======================================
+ Hits 7467 7471 +4
- Misses 2277 2278 +1
Partials 2 2 ☔ View full report in Codecov by Sentry. |


Fixes #8290
Description
Fixed CSS specificity conflict between AlertBox and markdown content styles.
The issue was not with the AlertBox background color, but with paragraph (
<p>) tags inside AlertBox inheriting black text color from markdown styles instead of maintaining white text. Added!importantto override markdown paragraph styles and ensure text remains white.Changes
* { color: white !important; }to AlertBox stylesbg-info-600as per design systemValidation
How to test:
pnpm dev/blog/migrations)Before:
After:
Related Issues
Check List
pnpm formatto ensure the code follows the style guide.pnpm testto check if all tests are passing.pnpm buildto check if the website builds without errors.