dequelabs / dequelabs/axe-core

False Positive: <li> inside <menu role="toolbar"> triggers "List item parent element has a role that is not role='list'"

Open
#5,073 14 comments 0 reactions 0 assignees View on GitHub
fix info needed
Dominant language
JavaScript
Stars
7.5k
Forks
933
Avg merge
2d 13h
Merged PRs (30d)
29

Description

### Product

axe Extension

### Product Version

4.126.2

### Latest Version

- [x] I have tested the issue with the latest version of the product

### Issue Description

#### Expectation

The `` elements is an HTML element defined as a semantic alternative to `

    ` for interactive items. According to the [W3C HTML Living Standard](https://html.spec.whatwg.org/multipage/grouping-content.html#the-menu-element) and [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/menu#specifications), a `` element validly accepts `
  • ` elements as direct children.

    I expected axe-core to recognize the `` element as a valid parent for `

  • ` tags, even when the `` is assigned a functional ARIA role like `role="toolbar"`, without triggering structural integrity errors.

    #### Actual
    Axe-core flags a Serious impact error: `

  • ` elements must be contained in a `
      ` or `
        `.
        The tool specifically fails the audit because the parent element (``) has a role other than `role="list"`. This results in multiple false positives (22 errors in my specific case) for markup that is semantically and syntactically correct according to HTML specifications.

        #### How to Reproduce
        Run an axe-core audit on the following HTML structure:

        ```html


      1. B


      2. I


      3. U
      4. ```

        #### Additional context
        This issue forces developers to either use non-semantic `

        ` tags or ignore serious accessibility flags, which is counter-intuitive for accessibility-first development.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.