Skip to content

a11y: collapsed navbar toggler has role="menu", an invalid role for a <button> (aria-allowed-role) #14615

Description

@cwickham

I have:

  • searched the issue tracker for similar issues
  • installed the latest version of Quarto CLI
  • formatted my issue following the Bug Reports guide

Bug description

The website navbar's collapse toggle is rendered as:

<button class="navbar-toggler" type="button"  role="menu" aria-expanded="false" aria-label="Toggle navigation">

role="menu" is not a valid role for a <button>, so axe-core reports an
aria-allowed-role violation ("ARIA role menu is not allowed for given
element") on .navbar-toggler.

The toggle button is only visible when the navbar collapses to the hamburger at
narrow viewports, so the violation only surfaces when axe runs against a narrow
(mobile-width) layout — which is likely why it hasn't shown up in wide-viewport
scans.

Note on severity: this is a Best Practice finding in axe-core (tags
cat.aria, best-practice; impact: minor). It is not tied to a WCAG
success criterion, so it is not a WCAG conformance failure — just an ARIA
correctness recommendation.

The role="menu" originates in the navbar toggle template:

<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarCollapse"
aria-controls="navbarCollapse" role="menu" aria-expanded="false" aria-label="<%- language['toggle-navigation'] %>"
onclick="if (window.quartoToggleHeadroom) { window.quartoToggleHeadroom(); }">
<span class="navbar-toggler-icon"></span>
</button>

AI-assisted investigation, grounded in a local clone of quarto-cli (per
CONTRIBUTING.md, "Using AI tools to investigate").

Steps to reproduce

A minimal two-file website project:

_quarto.yml

project:
  type: website
website:
  title: "Hamburger reprex"
  navbar:
    right:
      - text: Home
        href: index.qmd
      - text: About
        href: index.qmd
format:
  html:
    axe:
      output: document

index.qmd

---
title: "Home"
---

{{< lipsum >}}

quarto preview, then narrow the window until the navbar collapses to the hamburger (or open dev-tools device emulation at e.g. 600px wide). Refresh, and the axe report overlay shows the violation.

Actual behavior

axe-core reports aria-allowed-role (impact: minor) on .navbar-toggler: "ARIA role menu is not allowed for given element", because the <button> carries role="menu".

Expected behavior

No violation.

Your environment

  • IDE: n/a — reproduced with the Quarto CLI from the terminal (editor: Positron)
  • OS: macOS 26.5.1 (build 25F80)

Quarto check output

Quarto 1.10.8
[✓] Checking versions of quarto binary dependencies...
      Pandoc version 3.8.3: OK
      Dart Sass version 1.87.0: OK
      Deno version 2.7.14: OK
      Typst version 0.14.2: OK
[✓] Checking versions of quarto dependencies......OK
[✓] Checking Quarto installation......OK
      Version: 1.10.8
      Path: /Applications/quarto/bin
[✓] Checking tools....................OK
      TinyTeX: v2026.04
      VeraPDF: 1.28.2
[✓] Checking Chrome Headless....................OK
      Using: Chrome found on system
[✓] Checking basic markdown render....OK
[✓] Checking R installation...........OK
      Version: 4.6.0
      knitr: 1.51
      rmarkdown: 2.31
[✓] Checking Knitr engine render......OK
[✓] Checking Python 3 installation....OK
      Version: 3.12.2
      Jupyter: 5.9.1
[✓] Checking Jupyter engine render....OK

Metadata

Metadata

Assignees

No one assigned

    Labels

    accessibilitybugSomething isn't workinghtmlIssues with HTML and related web technology (html/css/scss/js)website-navigation

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions