Skip to content

Fix no-a11y-statement issue not being reported when statement is missing#104

Open
marcusosterberg wants to merge 3 commits into
mainfrom
fix/missing-statement-not-reported
Open

Fix no-a11y-statement issue not being reported when statement is missing#104
marcusosterberg wants to merge 3 commits into
mainfrom
fix/missing-statement-not-reported

Conversation

@marcusosterberg
Copy link
Copy Markdown
Contributor

Summary

Sites without an accessibility statement were silently getting a perfect
score because the missing-statement issue never reached
plugin-webperf-core. This PR fixes three interacting bugs so the issue
is now correctly emitted and scored.

Bugs fixed

  1. Wrong URL reference in checkNoAccessibilityStatement and
    getNextInterestingUrl.
    knowledgeData is an array, so
    this.groups[group]['knowledgeData']['url'] was always undefined.
    Fixed to use knowledgeData[0]['url'] with a fallback to start-url.

  2. Incomplete rule set when no statement is found. Only
    no-a11y-statement was added; the other rules (added as resolved
    on the happy path) were missing, so plugin-webperf-core had no
    a11y category to compute. Now the full rule set is populated.

  3. Issue added after per-page messages already sent.
    webPerfCoreSummary for each page was emitted during
    browsertime.har, but checkNoAccessibilityStatement ran later in
    sitespeedio.summarize. The plugin now re-publishes the first
    page's webPerfCoreSummary after the issue is added, so
    plugin-webperf-core sees it.

Also removed the duplicated issue-creation block inside
getNextInterestingUrl (at the 15-URL cap). The summarize-time path
now owns this logic in one place.

Verification

Tested against two sites:

  • https://finsamornskoldsvik.se (no statement): now correctly produces
    a no-a11y-statement issue with severity critical, plus the
    remaining rules as resolved, on both page and group level.
  • https://eskilstuna.se (has a "delvis förenlig" statement):
    unchanged. Still produces score.a11y: 90 with compatible-word-partly
    as error and the rest as resolved.

Related

Fixes <link to issue in Webperf-se/webperf_core>

When a site has no accessibility statement, the plugin previously
emitted an empty issues list and the page silently received a perfect
score. This commit makes the missing-statement case visible to
plugin-webperf-core so it can be scored correctly.

Three interacting bugs are fixed:

1. checkNoAccessibilityStatement (and a duplicated block in
   getNextInterestingUrl) referenced this.groups[group]['knowledgeData']['url'],
   but knowledgeData is an array. The URL on the resulting issue was
   undefined. Use knowledgeData[0]['url'] with a fallback to
   the group's start-url.

2. When no statement was found, only 'no-a11y-statement' was added to
   knowledgeData.issues. The remaining rules (which the happy path adds
   as 'resolved') were missing, leaving plugin-webperf-core with no a11y
   category to score. Now the full rule set is populated, matching the
   shape produced when a statement is found.

3. checkNoAccessibilityStatement only ran during sitespeedio.summarize,
   but by then the per-page webPerfCoreSummary message had already been
   sent with empty issues. Re-publish webPerfCoreSummary for the first
   page after the missing-statement issue is added so plugin-webperf-core
   sees the updated state.

The duplicated issue-creation block inside getNextInterestingUrl
(triggered at the 15-URL cap) has been removed; checkNoAccessibilityStatement
now owns this logic in a single place.
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.

Sites missing an accessibility statement incorrectly get a perfect score (100/5.0) instead of failing

1 participant