-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
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
Navbar logos not exposing empty alt text #7658
Comments
We should be using
|
Found that as well - PR coming very shortly |
Sweet! Not sure about the |
|
|
Nope, that's not it either. |
So yes, |
More context in the discussions on #7659, but we ultimately decided to get a little more opinionated on logo alt text. The new flow is:
|
Have you read the Contributing Guidelines on issues?
Prerequisites
npm run clear
oryarn clear
command.rm -rf node_modules yarn.lock package-lock.json
and re-installing packages.Description
When an image is truly decorative (i.e., it doesn't add additional context or information), we can apply
alt=""
(distinct from not supplying analt
attribute at all). This removes it from screenreader output, reducing clutter. This is especially pertinent for logos inside of links that also contain other link text, such as the typical navbar brand link. W3C's Web Accessibility Initiative's guidance on alt text for functional images includes an example just like this, where they recommend:Prior work (#3352 and #3817) enabled Docusaurus users to provide empty strings for these
alt
properties in their configs. However, when they do so, the logos are provided alts anyways, populated with the site title. As a result, Docusaurus users are not able to meaningfully mark their logos as decorative to reduce screenreader clutter.Reproducible demo
https://stackblitz.com/edit/github-rvbfnk?file=docusaurus.config.js
Steps to reproduce
docusaurus.config.js
, specifically the config for the navbar logo, which should have analt: ''
property.alt
attribute of"My Site"
, instead of the empty string.Expected behavior
If the user supplies an empty string for the logo's
alt
(distinct from not providing analt
at all, or providingundefined
ornull
), the logo should applyalt=""
, marking it as decorative for assistive technologies. Screenreaders won't announce the logo, and navigating to the brand link should just announce the site title once.Actual behavior
When the user supplies an empty string for the logo's
alt
config, thealt
attribute is being populated with the site title. This means that screenreader announcements are cluttered with redundant duplication.Your environment
Latest versions as used on the StackBlitz playground.
See repro on StackBlitz
Self-service
The text was updated successfully, but these errors were encountered: