-
-
Notifications
You must be signed in to change notification settings - Fork 1
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
Adjust ratio for opacity #222
Conversation
✅ Deploy Preview for oddcontrast ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
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.
looks good. Might be nice to have a checkerboard under the sample area, for when background color is not opaque?
Co-authored-by: Miriam Suzanne <miriam@oddbird.net>
@mirisuzanne Good idea. I added one, but is there a way to have a background color on a layer above an image? It looks like a color is only valid as the last value. I ended up using a linear-gradient to create a solid color, but there has to be a better way. |
@mirisuzanne or @stacyk I'm assigning to you, as I think there's potentially some style cleanup to prevent a layout jump when the warning message is shown, and also since the icon doesn't feel spaced correctly. ![]() |
* main: lint Bump the dev-minor group across 1 directory with 15 updates Bump jsdom from 25.0.1 to 26.0.0 in the dev-major group Bump the dev-minor group with 6 updates upgrade node and yarn Bump the dev-minor group with 6 updates Bump the dev-minor group with 7 updates Bump the dev-minor group with 12 updates
let displayRatio = $derived(Math.round((ratio + Number.EPSILON) * 100) / 100); | ||
let pass = $derived(ratio >= RATIOS.AA.Normal); | ||
let alphaWarning = $derived.by(() => { | ||
if ($bg.alpha !== 1) | ||
return 'Alpha is not considered when the background is not opaque.'; |
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.
Could we link these two notes directly to the fuller description (expanding if necessary)?
If not that, we could consider adding the fuller explanation in a tooltip/dialog here instead of in the expandable "issues" section.
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.
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.
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.
Correct- that would be great!
I think I've fixed the layout jumping issues (in d4dccb8) and cleaned up the warning message in (bf7d3eb) @stacyk @SondraE Thoughts on how this is looking so far? Look at the warning message at the different break points and with passing and failing ratio. |
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.
@dvdherron I think this is going in a good direction!
There are a few breakpoints where the message seemed disconnected from the ratio and not aligned with the other content.


@SondraE I adjusted the spacing in some of those middle widths so that the warning isn't so far from the ratio. |
With the color issues move merged in, I added links from the warnings to the color section. @dvdherron The warnings will need to be styled. I assume the DOM will need to be changed somehow- feel free to do it, or let me know if you want me to. Because the issues are at the bottom of the page, the header won't be scrolled to the top of the page. I added a ![]() |
* main: clean up animation cleanup add outline to swap button animate swap button change sr-only text for switch button reduce space around switch button lint initial style cleanup for color swap button Better handling of dragging Start styling switch button Add button and drag to swap colors
Fixed the warnings in cf92e08
Changed this to where just the heading is highlighted. Too subtle? |
Accidentally changed the size of the fixed width column for the ratio number. Fixed in 607ea55 |
@stacyk @SondraE @mirisuzanne I think this is ready for final review. The biggest change was stacking the ratio number on top of the eventual warning on the narrowest screens. Oherwise it felt like the warning box grew really tall: And now that the color issues are linked to at the bottom of the page, the heading of the respective list item is subtly highlighted after following the "learn more" link in the warning. Is the color and the "diamond" too sublte? |
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.
This is all looking really good to me. I really like the idea of highlighting the title of the section the user is taken to after clicking Learn More. I wonder if it would feel even more related to the warning if the text color was the same pink as the warning text color and the same icon was used.
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.
this looks great. Just left a few notes on the code.
display: inline-flex; | ||
grid-area: number; | ||
justify-content: flex-start; |
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 wonder if we want to remove this, and let it stretch to fill the space?
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.
removed in 1044fb1
@@ -19,6 +41,15 @@ | |||
<span class="sr-only">The contrast ratio is</span> |
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 know it's not new here, but I don't think this is useful screen reader context. The heading directly before this says 'current ratio' already.
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.
Agreed. Removed in 1044fb1. On the topic, I wonder if (in another story) we should edit the click-to-copy buttons to say what exactly they are copying?
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.
Yeah, I don't know the best solution on those - but no harm oping an issue to explore it.
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.
looks great!
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.
Looks and works great!
Description
When foreground opacity is changed, the ratio is based on the premultiplied color.
If the background opacity is changed, the ratio is based on both colors without any opacity.
Related Issue(s)
#91
Steps to test/reproduce
https://deploy-preview-222--oddcontrast.netlify.app/
Todo