dequelabs / dequelabs/axe-core

Incomplete results have no message when a check omits `metadata.messages.incomplete`

Open Beginner friendly
#5,344 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
7.5k
Forks
933
Avg merge
2d 23h
Merged PRs (30d)
17

Description

## Description

When a check returns `undefined` (incomplete) and its JSON has no `metadata.messages.incomplete` entry, the node gets no message at all — `check.message` is `undefined` and `failureSummary` renders an empty bullet.

`lib/core/utils/publish-metadata.js` has two paths for incomplete messages and neither covers this case:

- The doT-template path is gated on `typeof messages.incomplete === 'object'`, which is `false` when the key is absent.
- The fallback then assigns `data.message = messages.incomplete`, i.e. `undefined`.

`incompleteFallbackMessage()` is imported in the file and used by `getDefaultMsg`, but `getDefaultMsg` is only reachable from inside `getIncompleteReason` — which the gate above stops from ever being called.

## Repro

`label-content-name-mismatch` has `pass` and `fail` messages but no `incomplete` message, and returns `undefined` for text that isn't human-interpretable:

```html
☄️
```

Running that rule on `develop` (`540ecae9`):

```
incomplete count: 1
check.message: undefined
node.failureSummary: "Fix any of the following:\n "
```

## Expected

Fall back to `incompleteFallbackMessage()` so the node carries a usable message.

## Scope

Seven checks currently have a literal `return undefined` and no `incomplete` message: `label-content-name-mismatch`, `listitem`, `only-dlitems`, `only-listitems`, `important-letter-spacing`, `important-line-height`, `important-word-spacing`.

## Notes

Surfaced while reworking #5302, where a check-level `incomplete` message was added and then reverted as out of scope for that PR.

Contributor guide

Open the contributing guide

Research direction

Start in lib/core/utils/publish-metadata.js and trace the incomplete-message template path, getIncompleteReason, getDefaultMsg, and incompleteFallbackMessage. Reproduce the issue with label-content-name-mismatch and the supplied button markup. Done means the seven checks that return undefined without an incomplete message produce a usable fallback in check.message and failureSummary.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
accessibility
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
74/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.