Skip to content

[9.2] [Scout][a11y] adding axe-core validation (#243953)#244797

Merged
alexwizp merged 3 commits intoelastic:9.2from
alexwizp:backport/9.2/pr-243953
Dec 2, 2025
Merged

[9.2] [Scout][a11y] adding axe-core validation (#243953)#244797
alexwizp merged 3 commits intoelastic:9.2from
alexwizp:backport/9.2/pr-243953

Conversation

@alexwizp
Copy link
Copy Markdown
Contributor

@alexwizp alexwizp commented Dec 1, 2025

Backport

This will backport the following commits from main to 9.2:

Questions ?

Please refer to the Backport tool documentation

**Summary**
- Integrates `axe-core` accessibility checks into our test-suite for
`Scout`.
- Adds a shared helper `checkA11y` that runs axe on a given DOM context.
- Targets automated detection of common accessibility issues (color
contrast, missing ARIA, etc.) so we catch regressions earlier.
Configuration is unified with Cypress and FTR

**Why**
- Improve accessibility coverage by running automated checks in-unit and
in functional tests.
- Provide a simple, reusable helper for tests so authors can validate
accessibility as part of normal test work.

**What changed**
- Adds `axe-core` dependency and wiring to run it in tests.
- Introduces `checkA11y` helper used by existing tests. This method is
accessible through the `Page` object.

**How to use**
> [!NOTE]
>We recommend running `checkA11y` with the `include` parameter set to
the root element you are testing. This makes the tests more isolated and
reduces the time required to analyze the DOM structure.

```
test('an example of using the checkA11y check', async ({ page }) => {
  ....

  const { violations } = await page.checkA11y({ include: ['{CSS selector of root element you are testing}'] });
  expect(violations).toHaveLength(0);
});

```

## Screens

**Example of report**

<img width="963" height="326" alt="image"
src="https://github.com/user-attachments/assets/c8450ad8-deea-47c3-a4d7-e7e2e0a73d88"
/>

**ESLint issue*

<img width="963" height="326" alt="Screenshot 2025-11-28 at 15 23 55"
src="https://github.com/user-attachments/assets/387400ac-4fb8-45d6-9649-09f7ee3fb8f5"
/>

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
(cherry picked from commit 1caf007)

# Conflicts:
#	.buildkite/scripts/steps/security/third_party_packages.txt
#	package.json
#	src/platform/packages/shared/kbn-scout/moon.yml
#	src/platform/packages/shared/kbn-scout/src/playwright/fixtures/scope/test/scout_page/index.ts
#	src/platform/packages/shared/kbn-scout/src/playwright/fixtures/scope/test/scout_page/single_thread.ts
#	src/platform/packages/shared/kbn-scout/src/playwright/utils/index.ts
@alexwizp alexwizp added the backport This PR is a backport of another PR label Dec 1, 2025
@alexwizp alexwizp enabled auto-merge (squash) December 1, 2025 15:59
@elastic elastic deleted a comment from elasticmachine Dec 2, 2025
@alexwizp alexwizp merged commit 45c828e into elastic:9.2 Dec 2, 2025
12 checks passed
@elasticmachine
Copy link
Copy Markdown
Contributor

💚 Build Succeeded

Metrics [docs]

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
@kbn/axe-config 12 13 +1

Public APIs missing exports

Total count of every type that is part of your API that should be exported but is not. This will cause broken links in the API documentation system. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats exports for more detailed information.

id before after diff
@kbn/scout 25 26 +1
Unknown metric groups

API count

id before after diff
@kbn/axe-config 12 13 +1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport This PR is a backport of another PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants