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(theme-classic): expose empty string alt text in navbar logos #7659

Merged
merged 4 commits into from Jun 23, 2022
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -32,7 +32,7 @@ export default function Logo(props: Props): JSX.Element {
sources={sources}
height={logo.height}
width={logo.width}
alt={logo.alt || navbarTitle || title}
alt={logo.alt ?? (navbarTitle || title)}
Copy link
Collaborator

Choose a reason for hiding this comment

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

What do you think about the case of alt: undefined and navbar: { title: "TypeScript ESLint" }? Should we use alt="" as well (sounds more sensible to me)?

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'm pretty much of the mindset that if any text appears in the same link as the logo, the logo should have alt="" - since at that point, the logo serves only to adorn that text.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Shall we use something closer to the line of logo.alt ?? (navbarTitle ? "" : title) then? (Plus a comment like "respect empty alt, don't show alt that's duplicated from navbar title")

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure - I'll pull that out into its own declaration though, so that way it's not all inlined.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated

/>
);

Expand Down
2 changes: 1 addition & 1 deletion website/docusaurus.config.js
Expand Up @@ -399,7 +399,7 @@ const config = {
hideOnScroll: true,
title: 'Docusaurus',
logo: {
alt: 'Docusaurus Logo',
alt: '',
src: 'img/docusaurus.svg',
srcDark: 'img/docusaurus_keytar.svg',
width: 32,
Expand Down