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

Remove uppercase transformation from sidebar tab items for accessibility reasons #2043

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

hichemfantar
Copy link
Contributor

@hichemfantar hichemfantar commented Jan 20, 2025

Improved readability by removing the uppercase transformation from sidebar list items.

this solution even saves horizontal space

Important for accessibility

research:
https://www.a11y-101.com/design/capitalisation

https://accessibility.huit.harvard.edu/design-readability

Avoid using all caps. Readability is reduced with all caps because all words have a uniform rectangular shape, meaning readers can't identify words by their shape.

tldr: The best thing to do is to avoid uppercase letters

before
image

after
image

@hichemfantar hichemfantar changed the title Remove uppercase transformation from sidebar list items Remove uppercase transformation from sidebar list items for accessibility reasons Jan 20, 2025
Copy link

@hichemfantar hichemfantar marked this pull request as ready for review January 20, 2025 17:47
@hichemfantar hichemfantar changed the title Remove uppercase transformation from sidebar list items for accessibility reasons Remove uppercase transformation from sidebar tab items for accessibility reasons Jan 20, 2025
@josevalim
Copy link
Member

After rebasing this pull request with some other changes, I think the menu is not calling enough attention to it, especially the currently selected item:

Screenshot 2025-01-21 at 20 36 27

I think we may need other changes to either the selected one or all of them, to make them standout more.

@josevalim
Copy link
Member

josevalim commented Jan 21, 2025

FWIW, the vitepress plugin makes the font a bit darker, docusaurus changes the color of the selected item. We probably want to apply this here and to our regular tabsets. Another option is to bold the currently selected item.

@hichemfantar
Copy link
Contributor Author

hichemfantar commented Jan 21, 2025

the menu doesn't call attention because it previously relied on uppercase to make up for the thin font (still bad in terms of a11y), but now without uppercase we need to bring back the font to a normal level so it looks visible enough

example

image

@hichemfantar
Copy link
Contributor Author

hichemfantar commented Jan 21, 2025

also notice how vite and the new font weight are pretty much identical (further proof (besides the research i linked) it's the more correct weight to use because vitepress has a large team behind with lots of experience in building great web experiences)

image

image

@josevalim
Copy link
Member

I tried the increased font-weight locally to all of them and I thought it was still too subtle. :( You can see in the image above vitepress is also changing other styles besides of only the border.

@hichemfantar
Copy link
Contributor Author

i suppose we could slightly lower the opacity of inactive elements but that would be horrible for readability if we keep the light font.

@josevalim
Copy link
Member

I agree. I will play with some ideas too. WDYT about bolding the current selection? I want to avoid changing the font color though, because that changes per theme and language, and it will be hard to guarantee all languages look good across all themes.

@hichemfantar
Copy link
Contributor Author

bolding the current selection would cause a slight layout shift when changing selection and the light weight font would still be an issue since the recommended value is 500 which is the same in all documentation engines i've worked with

@josevalim
Copy link
Member

Good point on bolding and there is no need to repeat the information we are discussing in the other issue, I am aware.

In any case, if we cannot make the tabs look better in isolation, then we may need to look for other approaches.

@hichemfantar
Copy link
Contributor Author

i repeated the info for other participants in the other issue to be aware because it's related to the font issue

@hichemfantar
Copy link
Contributor Author

Although i find the current implementation to be good enough in terms of visibility we could go with this approach which addresses the accessibility issues while calling the attention you feel is missing

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants