dequelabs / dequelabs/axe-core

`isModalOpen()` false negative on decorative background causes `landmark-one-main` to pass

Open
#5,258 1 comment 0 reactions 0 assignees View on GitHub
commons false negative rules
Dominant language
JavaScript
Stars
7.5k
Forks
933
Avg merge
2d 23h
Merged PRs (30d)
17

Description

### Product

axe-core

### Product Version

4.12.1

### Latest Version

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

### Issue Description

#### Expectation

`landmark-one-main` should report a failure on a page that has no `` element, regardless of decorative background elements

#### Actual

`landmark-one-main` passes when the page contains a `position: fixed` full-viewport background element (e.g. a decorative gradient overlay), because `isModalOpen()` incorrectly classifies it as a modal, which triggers the `passForModal` short-circuit in [`has-descendant-evaluate.js`](https://github.com/dequelabs/axe-core/blob/8fcb57cd61f3483bdb8870ef85c5f584b1d8ac57/lib/checks/generic/has-descendant-evaluate.js#L11-L13)

#### How to Reproduce

```html

Repro


Hello


No main element on this page.

```

#### Additional context

The `passForModal` option was introduced in PR #3501 to fix #3359 (real modals causing `landmark-one-main` to incorrectly fail).
That fix works correctly for actual dialogs.
However, the `isModalOpen()` heuristic behind it lacks checks that would distinguish decorative elements from real modals

Contributor guide

Open the contributing guide

Research direction

Start with isModalOpen() and the passForModal short-circuit in lib/checks/generic/has-descendant-evaluate.js, then reproduce the provided HTML case. Verify that landmark-one-main fails without a main element when the fixed decorative background is present, while the existing actual-dialog behavior remains correct.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
accessibility
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.