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
Ally-compliant color palette & functions #9319
Conversation
While replacing I also noticed that Tabs' mixins didn't allow for passing any vars when creating your own tabs. Fixed this too. Finally, I added settings for tab item font colors. You could previously set the tab items' background, but not their color. |
Just like Tabs, it's the same case for Accordion & Pagination (foreground function sets the text color but the background color is explicitly set, and mixins don't pass vars). Fixing those too… |
👍 |
Travis failure appears to be real - @andycochran can you take a look? |
I don't know why |
v4.2.2 throws the same error:
|
Found the issue. The scss tests import files individually... this PR introduces a dependency for color on math. You can fix the failure by adding an @import 'math' into |
I can fix the above issue as a part of the merge if you like. Other than that, is this ready to go @andycochran @ncoden? |
@kball fixed. I think this is good to go so long as Zurb is cool with the new ally-compliant color palette. It's not as vibrant. I also wouldn't mind a "LGTM" from @ncoden or @brettsmason. |
Hmm… looks like Travis is still upset. |
Bah, kicking travis, looks like that spurious phantom download error. @zurbrandon @tdhartwick @gakimball any of you have thoughts on this new default palette? |
@@ -47,7 +51,7 @@ $badge-font-size: 0.6rem !default; | |||
@if $name != primary { | |||
&.#{$name} { | |||
background: $color; |
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 should rename $color
by $background
here
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.
I'm not sure about this. The $foundation-palette
is a list of colors, not a list of backgrounds. We're using a $color
from the palette to set a background
. Seems logical as-is to me.
font-size: $accordion-title-font-size; | ||
color: $accordion-item-color; | ||
font-size: $font-size; | ||
color: $color; |
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.
Why does some components have an alternative color, and others doesn't ?
It could be useful to use a common color format like a ($color-light, $color-dark)
list (for background too), and a mixin like component-skin($background-list: (), $color-list: (), $pick-best-contrast: true)
to use it in components.
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.
I avoided -light
and -dark
because the default button and label do not use the $pick-best-contrast
function. You might make an app with a dark background and a bright default button with dark text. If necessary, the buttons created from the palette use the alt color, which might be light.
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.
Oh, and I'm only using alt colors for component that create classes with an @each
loop for the $foundation-palette
. Components that do not use a $foundation-palette
loop do not need an alt color.
display: block; | ||
padding: $accordion-item-padding; | ||
padding: $padding; | ||
line-height: 1; |
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.
font-size
before line-height
$background: $accordion-content-background, | ||
$color: $accordion-content-color | ||
) { | ||
padding: $padding; | ||
display: none; |
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.
display
before padding
Please rebase, then run gulp sass:lint
;)
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.
gulp lint:sass
😉
success: #3adb76, | ||
warning: #ffae00, | ||
alert: #ec5840, | ||
alert: #cc4b37, |
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.
If you have a reference for these colors, can you add the link in 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.
I'm not sure I understand what you're asking for. Do you mean adding something like this as an inline comment for each of the colors?
// http://webaim.org/resources/contrastchecker/?fcolor=ffffff&bcolor=cc4b37
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.
I mean : How did you find that we should use these particular colors, and not, for example, #cc4b38
?
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.
I used Photoshop to incrementally adjust the original color's luminosity (keeping the same hue and saturation, changing only the brightness), checking each incremental change in the WebAIM Contrast Checker, until the change allowed the new color to meet AA requirements.
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.
Ok. I think it could be useful to add the link to test the contrast, with an explanation.
@ncoden Thanks for the feedback. I'll work on this tomorrow. |
a9cbf60
to
0812226
Compare
Can't we keep background colors for a white text ? |
@ncoden In order to keep white text for the Success and Warning buttons, the colors have to darken quite a lot. The gold ends up being an ugly brown. In order to change the palette as little as possible—and because I like the existing green/gold—I decided to leave the Success and Warning colors as they are. They meet AA requirements with the alt text color. |
@andycochran I understand. But the different text colors disturb me. And I don't find the Maybe we should change the hue, saturation and luminosity to have beautiful and ally-compliant background colors without different text colors. |
@ncoden I'd love it if we could come up with that palette. But AA contrast requirements quite limiting. I think we can only get two out of these three: 1) beautiful 2) ally-compliant 3) white text. Please feel free to propose new colors. I imagine most designers who don't care about AA requirements will simply set Maybe the alt text color is visually awkward because all the buttons are shown in a row here? In practice, buttons won't often be arranged this way. |
@andersonaguiar Also, In practice, I often see a primary button next to a warning button. :/ |
I checked with WebAIM, and didn't find a a11y-compliant (AA) color for a white text that is not ugly 😞. Also, But could we, instead of changing the default colors, provide a set of tools to help websites to provide an alternative Also, Firefox allows the user to overriding the page colors (but not Chrome). |
Don't worry about contrast for
Again, I think this comes down to a judgement Zurb should make. Should Foundation Sites actually be "fully-accessible" as advertised, and must that include meeting AA contrast requirements out-of-the-box? |
We are focusing so much on accessibility with the framework that imo we should make it be compliant out of the box. Of course this is a thing that the ZURBians have to decide, but as we are promoting to be "fully-accessible" as @andycochran said this should be the goal. Maybe we have to go even further and add some contrast checking to the SASS and/or the "custom download" page. The biggest problem with a11y will always be that people are not aware of it or just don't care and thus we should give them as much help as we can to create compliant websites so they'll actually do. |
The updated compliant palette @andycochran suggested is a super solid compromise. @shannon-zurb and I tinkered with the palette this morning and arrived at a similar conclusion - white text on green and yellows is hard to make look beautiful and accessible. Question came up in the office here - should we make the compliant palette a variable that can be disabled (or enabled)? We fear that defaulting the framework's color palette to be compliant maybe regressive. Sites may have intentionally used the current out-of-the-box colors because it aligns with their brand. @zurbrandon @tdhartwick |
@MandiSaeteun I don't think an extra variable just to turn on a11y colors is necessary—especially if it's on by default. Just as easily as turning it off, you could set your alt-colors to white. If this was a patch, I might agree that we shouldn't break folks' button colors. But it's a minor version with other changes that require reviewing your |
Looks like there are some new conflicts. I'll get these fixed… @kball / @MandiSaeteun, any further thoughts from Zurb on out-of-the-box compliance? |
0812226
to
a516f08
Compare
I think the callout have similar problem, in the setting they are a $callout-font-color-alt but never used and it sould be great if the background is dark the alt color is used. |
@@ -96,7 +96,8 @@ $orbit-control-zindex: 10 !default; | |||
padding: $orbit-caption-padding; | |||
|
|||
background-color: $orbit-caption-background; | |||
color: foreground($orbit-caption-background); | |||
color: color-pick-contrast($orbit-caption-background); | |||
background-color: $orbit-caption-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.
"background-color: $orbit-caption-background;" is duplicated line 98 and 100
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.
Ack! Must've missed that when rebasing and fixing a merge conflict. I'll clean this up…
@andycochran Our consensus has been that out of the box compliance is very important, and worth sacrificing a little bit of backwards compatibility. Lets write a migration note that addresses this and lets people know how they can revert to the previous palette. Other than this, is this ready to merge? |
@kball AFAIK, it's ready to merge. Didn't wanna add that label to my own PR tho. |
Merged! @andycochran can you write a quick migration note (comment in this PR would be fine) highlighting what the change is and how someone would get back to the previous palette if they wanted to? |
Migration notesNew functions
Revised settings variables
New settings variables
Mixins
|
@andycochran I think it would be valuable to add a note to the docs for buttons, badges, and labels that explains why they have mixed text colors out of the box, and how to change it to all white (with a warning that it will reduce your contrast below AA contrast requirements) |
@kball Will do… |
This PR, which effects every component that used the
foreground()
function, addresses #7387. I've adjusted the$foundation-palette
to meet AA contrast requirements. Theforeground()
function has been replaced with a newpick-best-color()
function that uses luminosity instead of lightness (which fails as #7387 explains).