Skip to content
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(placement): reuse TextColor/BackgroundColor for "AD" link #11540

Merged
merged 2 commits into from
Jul 26, 2024

Conversation

caugner
Copy link
Contributor

@caugner caugner commented Jul 26, 2024

Summary

(MP-1400)

Problem

#11498 added custom color support for the new sidebar format, but the color of the "AD" link remained hard-coded, which causes contrast issues.

Solution

Reuse TextColor for the link background and BackgroundColor for the link text, while maintaining the current opacity of 40%.

Note: The hover effect stays the same, i.e. the opacity is unset and the underline is removed on hover.


Screenshots

Default state Hover state
Before image image
After image image

How did you test this change?

Ran yarn dev with REACT_APP_KUMA_HOST=developer.allizom.org and refreshed http://localhost:3000/en-US/docs/Learn/HTML until a placement using the new sidebar format showed up.

@caugner caugner requested a review from a team as a code owner July 26, 2024 10:58
@caugner caugner changed the title fix(placement): use TextColor/BackgroundColor for "AD" link fix(placement): reuse TextColor/BackgroundColor for "AD" link Jul 26, 2024
Copy link
Member

@LeoMcA LeoMcA left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

font-size: 0.625rem;
margin: 0.5rem;
opacity: 0.4;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think opacity messes with contrast detection in Firefox's accessibility tools, but I don't see another way since relative colours don't have wide support (not sure why that page doesn't have a BCD table).

Copy link
Contributor Author

@caugner caugner Jul 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just checked and it looks like Firefox DevTools Accessibility Tools take the opacity into consideration, i.e. the opacity: 0.4 does not have enough contrast, but it's kind of by design. (Increasing to opacity: 0.8, for example, resolves the displayed Contrast issue.)

@caugner caugner merged commit 16a6717 into main Jul 26, 2024
15 checks passed
@caugner caugner deleted the MP-1400-fix-ad-link branch July 26, 2024 12:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants