Skip to content

fix(theme): provide accessible aria-label on navbar title when siteTitle is false - #5587

Open
abdul-karim-mia wants to merge 1 commit into
vuejs:mainfrom
abdul-karim-mia:fix/nav-bar-title-aria-label
Open

abdul-karim-mia wants to merge 1 commit into
vuejs:mainfrom
abdul-karim-mia:fix/nav-bar-title-aria-label

Conversation

@abdul-karim-mia

Copy link
Copy Markdown
Contributor

Description

When themeConfig.siteTitle is configured as false, the navbar title text is hidden. If themeConfig.logo is defined as a string (e.g. logo: '/my-logo.svg') or without an alt attribute, <VPImage> renders <img alt="" /> and neither <span> renders inside <a class="title">. Consequently, the navigation link to the site home page has no discernible accessible name for screen readers and accessibility audits.

This PR provides a fallback aria-label="site.title" on <a class="title"> when:

  1. theme.siteTitle === false, and
  2. theme.logo does not already provide an alt attribute (so we don't override explicit alt text).

In all other cases (default or custom visible site title, or logo with alt text), aria-label remains undefined.

Linked Issues

Addresses #5056

Additional Context

  • Added unit tests in __tests__/unit/client/theme-default/components/VPNavBarTitle.test.ts covering:
    • Default visible title: no aria-label
    • Custom visible title: no aria-label
    • siteTitle: false with string logo: aria-label="<site.title>"
    • siteTitle: false with logo alt: no aria-label
  • All 34 unit test files (531 tests) pass locally.
  • Prettier formatting validated.

…tle is false

Signed-off-by: Abdul karim mia <akmia51@gmail.com>
@netlify

netlify Bot commented Nov 22, 2026

Copy link
Copy Markdown

👷 Deploy request for vitepress-docs pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 770ddbe

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant