-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
(enh) improve default theme accessibility #3402
(enh) improve default theme accessibility #3402
Conversation
e0c83ca
to
ef08f0b
Compare
ef08f0b
to
6865cb7
Compare
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.
Because I dealt with this in highlight.php, just some nitpicks if we want this tool to be robust enough to scan all of our themes.
function contrast_report(rules) { | ||
console.log("Accessibility Report".yellow); | ||
|
||
var hljs = rules.find (x => x.selectors && x.selectors.includes(".hljs")); |
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.
var hljs = rules.find (x => x.selectors && x.selectors.includes(".hljs")); | |
var hljs = rules.find(x => x.selectors?.includes(".hljs")); |
nitpick
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.
As you point out this isn't supported everywhere so I'm going to slow down with it until we figure our how/where to specify that dev work requires newer versions...
this.bg = rule.declarations.find(x => x.property =="background")?.value; | ||
this.fg = rule.declarations.find(x => x.property =="color")?.value; |
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.
Two notes on this one:
-
Some styles use
background-color
to differentiate the background for specific elements. I think we should add support for checkingbackground-color
for WCAG contrast.
highlight.js/src/styles/foundation.css
Lines 74 to 77 in 0bf3ade
.hljs-regexp { background-color: #fff0ff; color: #880088; } -
Should we have a minimum Node defined somewhere for dev environments? Optional chaining was added in Node 14 and our
package.json
requires Node 12+ (correctly so, for our users).
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.
Should we have a minimum Node defined somewhere for dev environments?
Ah, we probably should, but where... damn old versions of Node. :-)
Some styles use background-color
I'll break this out into a separate issue... the tool doesn't have to be perfect for the main thrust of this to be mergeable.
contrastRatio() { | ||
if (!this.foreground) return "unknown (no fg)" | ||
if (!this.background) return "unknown(no bg)" | ||
return round2(wcagContrast.hex(this.foreground, this.background)); |
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.
We have some themes that use rgba()
, will .hex()
work on those values?
highlight.js/src/styles/arduino-light.css
Lines 52 to 54 in 0bf3ade
.hljs-comment { | |
color: rgba(149,165,166,.8); | |
} |
Co-authored-by: Vladimir Jimenez <allejo@me.com>
Co-authored-by: Vladimir Jimenez <allejo@me.com>
Resolves #3393.
Changes
Dark Theme
Light Theme
Checklist
CHANGES.md