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

enhance(design): improve style of current item in menu #11061

Open
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

caugner
Copy link
Contributor

@caugner caugner commented May 3, 2024

Summary

(MP-1103)

Problem

  1. The contrast of the highlighted menu item is too low in the light theme.
  2. The menu highlights the current page in the menu by reducing its visibility, which is counter-intuitive.

Solution

Inverse the menu highlighting, reducing the opacity of the inactive items using opacity: 0.775, and increasing the contrast of the active item by switching from --text-secondary to --text-primary, which is the same color used for the MDN logo.

Note: Also removes the --text-active variable, which is no longer used.


Screenshots

Theme Before/After Screenshot
Light Before image
Light After image
Dark Before image
Dark After image

How did you test this change?

Ran yarn dev and compared http://localhost:3000/en-US/docs/Learn locally against https://developer.mozilla.org/en-US/docs/Learn.

caugner added 2 commits May 3, 2024 13:37
Dark theme: 4.67 (menu) / 5.31 (curriculum module list tabs).
Light theme: 4.51 (menu / curriculum module list tabs).
Active item gets darker (light theme) or brighter (dark theme) color.
@caugner caugner requested a review from a team as a code owner May 3, 2024 11:46
@caugner caugner changed the title enhance(design): inverse menu highlight + increase inactive item contrast enhance(design): inverse menu highlight + increase contrast May 3, 2024
@mirunacurtean
Copy link

Adding regression on stage currently, most noticeable in dark mode. Open the profile menu on a page with a content behind the menu, like https://developer.allizom.org/en-US/docs/Web/JavaScript and then use a mouse scroll motion to navigate the page. Notice the menu's opacity is decreased and it has become see through.
image

@caugner caugner marked this pull request as draft July 4, 2024 13:54
@caugner
Copy link
Contributor Author

caugner commented Jul 4, 2024

Adding regression on stage currently, most noticeable in dark mode. Open the profile menu on a page with a content behind the menu, like https://developer.allizom.org/en-US/docs/Web/JavaScript and then use a mouse scroll motion to navigate the page. Notice the menu's opacity is decreased and it has become see through. image

Good catch, thank you! I pushed a fix, and it's being deployed to stage now.

@caugner caugner changed the title enhance(design): inverse menu highlight + increase contrast enhance(design): improve style of current item in menu Jul 4, 2024
@caugner caugner marked this pull request as ready for review July 4, 2024 16:00
client/src/ui/base/_themes.scss Show resolved Hide resolved
client/src/ui/base/_themes.scss Show resolved Hide resolved
@@ -1,8 +1,12 @@
.top-level-entry-container {
&.active > a {
&:not(.active):not(.user-menu):not(:hover) {
opacity: 0.775;
Copy link
Member

Choose a reason for hiding this comment

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

Why are we using opacity rather than setting color?

Using opacity breaks Firefox's accessibility inspector, which doesn't take it into account when assessing contrast:

image

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I used opacity for simplicity, because it avoids having to define two additional colors for light and dark theme, and because it also applies to the "New" pill on the Tools menu (which would require another two colors).

TIL about Firefox's accessibility inspector ignoring opacity, but technically this PR increases contrast.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@LeoMcA Are you okay with merging this?

Copy link
Member

Choose a reason for hiding this comment

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

it also applies to the "New" pill on the Tools menu (which would require another two colors)

Why does it apply the the "New" pill? Isn't the point of that pill to draw attention? Why are we then making it stand out less?

but technically this PR increases contrast.

Does it? It decreases the contrast of the majority of links in the header. Taking a screenshot and colour picking the colour (#757575), then putting it in https://webaim.org/resources/contrastchecker/ shows we fail AAA contrast, which I don't think is good enough for some of the most prominent text on our site:

image

@caugner caugner force-pushed the improve-inactive-style branch from 682bd04 to 6415c73 Compare July 10, 2024 08:29
@caugner caugner requested a review from LeoMcA July 11, 2024 21:19
@LeoMcA
Copy link
Member

LeoMcA commented Aug 1, 2024

I don't want to bikeshed here, but I don't like this design: it doesn't make sense to me. I can't think of any other site which shows the active section of the site by making the links to the other sections lower contrast. The active section should be shown with an underline, or some other distinguishing feature, not by making the rest of the links hard to see.

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.

Contrast too low, design doesn't make sense

@github-actions github-actions bot added the idle label Sep 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants