# PR: Fix Insufficient Text-to-Background Contrast in Code Blocks (Issue #886) #998
Closed
NalinDalal wants to merge 1 commit into
Closed
# PR: Fix Insufficient Text-to-Background Contrast in Code Blocks (Issue #886) #998NalinDalal wants to merge 1 commit into
NalinDalal wants to merge 1 commit into
Conversation
Member
|
Hi @NalinDalal , thank you for your effort here but as I mentioned in #886, there was already someone working on this; additionally, the approach this PR takes is not quite comprehensive enough, and themes rather than overrides would be preferred. Thanks for understanding! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem / Issue
functionkeyword, had insufficient text-to-background contrast (e.g.,#D73A49on#F7F7F7), failing WCAG 2.1 AA (minimum 4.5:1 contrast ratio)..code-box,bg-bg-gray-40) was overriding the background, muting the intended high-contrast theme.<span style="color:#D73A49">function</span>as having a contrast ratio of 4.26:1 (below 4.5:1).How We Checked for the Issue
http://localhost:4321/tutorials/get-started/..code-box,bg-bg-gray-40, and color overrides.How We Tackled It
bg-bg-gray-40class from code block containers to prevent the light gray background from overriding the theme..code-boxbackground to pure white (#fff) in the main global styles for maximum contrast.functionkeyword to black, as it was a workaround, not a real fix.code-contrast-fix.scssfile and its import.What Changes Were Made
src/components/CodeContainer/index.astroto removebg-bg-gray-40from code block classes.styles/global.scssto set.code-box { background-color: #fff !important; }and removed the import forcode-contrast-fix.scss.src/styles/code-contrast-fix.scss..code-boxor.astro-codein the codebase.How We Ensured the Issue Was Tackled
Next Steps
This PR closes #886 and ensures all code blocks meet WCAG 2.1 AA contrast requirements.