-
Notifications
You must be signed in to change notification settings - Fork 26
v2.12.0 testing #175
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
v2.12.0 testing #175
Changes from all commits
5edd8b4
6ac9324
1a50d81
b80cbb9
d250560
79d3cfa
c050d25
3cf1970
daed7e9
738ba9c
9e6acc4
953a7b5
381f66f
4eab30a
effdb30
8985ccc
ff435ff
d397134
e930ceb
5bd8d26
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| export default async function reflowScan({page, addFinding} = {}) { | ||
| const originalViewport = page.viewportSize() | ||
| const url = page.url() | ||
| // Check for horizontal scrolling at 320x256 viewport | ||
| try { | ||
| await page.setViewportSize({width: 320, height: 256}) | ||
| const scrollWidth = await page.evaluate(() => document.documentElement.scrollWidth) | ||
| const clientWidth = await page.evaluate(() => document.documentElement.clientWidth) | ||
|
|
||
| // If horizontal scroll is required (with 1px tolerance for rounding) | ||
| if (scrollWidth > clientWidth + 1) { | ||
| await addFinding({ | ||
| scannerType: 'reflow-scan', | ||
| url, | ||
| problemShort: 'page requires horizontal scrolling at 320x256 viewport', | ||
| problemUrl: 'https://www.w3.org/WAI/WCAG21/Understanding/reflow.html', | ||
| solutionShort: 'ensure content is responsive and does not require horizontal scrolling at small viewport sizes', | ||
| solutionLong: `The page has a scroll width of ${scrollWidth}px but a client width of only ${clientWidth}px at a 320x256 viewport, requiring horizontal scrolling. This violates WCAG 2.1 Level AA Success Criterion 1.4.10 (Reflow).`, | ||
| }) | ||
| } | ||
| } catch (e) { | ||
| console.error('Error checking horizontal scroll:', e) | ||
| } finally { | ||
| // Restore original viewport so subsequent scans (e.g. Axe) aren't affected | ||
| if (originalViewport) { | ||
| await page.setViewportSize(originalViewport) | ||
| } | ||
| } | ||
| } | ||
|
|
||
| export const name = 'reflow-scan' |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| { | ||
| "name": "reflow-scan", | ||
| "version": "1.0.0", | ||
| "description": "Scans pages at a 320x256 viewport size to identify potential reflow issues, such as horizontal scrolling and content overflow.", | ||
| "type": "module" | ||
| } |
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -56,6 +56,7 @@ jobs: | |||||
| # open_grouped_issues: false # Optional: Set to true to open an issue grouping individual issues per violation | ||||||
| # reduced_motion: no-preference # Optional: Playwright reduced motion configuration option | ||||||
| # color_scheme: light # Optional: Playwright color scheme configuration option | ||||||
| # scans: '["axe","reflow-scan"]' # Optional: An array of scans (or plugins) to be performed. If not provided, only Axe will be performed. | ||||||
| ``` | ||||||
|
|
||||||
| > 👉 Update all `REPLACE_THIS` placeholders with your actual values. See [Action Inputs](#action-inputs) for details. | ||||||
|
|
@@ -125,7 +126,7 @@ Trigger the workflow manually or automatically based on your configuration. The | |||||
| | `include_screenshots` | No | Whether to capture screenshots of scanned pages and include links to them in filed issues. Screenshots are stored on the `gh-cache` branch of the repository running the workflow. Default: `false` | `true` | | ||||||
| | `reduced_motion` | No | Playwright `reducedMotion` setting for scan contexts. Allowed values: `reduce`, `no-preference` | `reduce` | | ||||||
| | `color_scheme` | No | Playwright `colorScheme` setting for scan contexts. Allowed values: `light`, `dark`, `no-preference` | `dark` | | ||||||
| | `scans` | No | An array of scans (or plugins) to be performed. If not provided, only Axe will be performed. | `['axe', ...other plugins]` | | ||||||
| | `scans` | No | An array of scans (or plugins) to be performed. If not provided, only Axe will be performed. | `'["axe", "reflow-scan", ...other plugins]'` | | ||||||
|
||||||
| | `scans` | No | An array of scans (or plugins) to be performed. If not provided, only Axe will be performed. | `'["axe", "reflow-scan", ...other plugins]'` | | |
| | `scans` | No | An array of scans (or plugins) to be performed. If not provided, only Axe will be performed. | `'["axe","reflow-scan"]'` | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The fallback
getFindingKey(url;scannerType;problemUrl) can easily collide for multiple findings on the same page (e.g., plugins that report multiple elements but share the sameproblemUrl). Collisions will cause findings to be incorrectly associated with an existing issue, potentially dropping/merging distinct findings. Consider incorporating additional stable fields into the fallback (e.g.,problemShortand/orsolutionShort, or a dedicatedfingerprintfield onFindingfor non-Axe scans).