Add workflow input options for reducedMotion and colorScheme#145
Add workflow input options for reducedMotion and colorScheme#145
reducedMotion and colorScheme#145Conversation
Co-authored-by: JoyceZhu <6251669+JoyceZhu@users.noreply.github.com>
Co-authored-by: JoyceZhu <6251669+JoyceZhu@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This pull request adds support for Playwright's reducedMotion and colorScheme emulation parameters to the accessibility scanner. These parameters allow users to test their websites under different user preference conditions for motion and color schemes.
Changes:
- Added two new optional inputs (
reduced_motionandcolor_scheme) to the main action and find sub-action - Implemented input validation in the find action to ensure only valid Playwright values are accepted
- Threaded the parameters through to Playwright's browser context configuration
- Updated documentation in README.md and the find action's README.md
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| action.yml | Added reduced_motion and color_scheme input definitions and passed them to the find sub-action |
| README.md | Documented the new optional inputs with examples and allowed values |
| .github/actions/find/action.yml | Added input definitions for the find sub-action |
| .github/actions/find/src/index.ts | Implemented input validation and parameter extraction |
| .github/actions/find/src/findForUrl.ts | Added parameters to function signature and applied them to Playwright context options |
| .github/actions/find/README.md | Documented the new inputs with links to Playwright API documentation |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| 📄 This project is licensed under the terms of the MIT open source license. Please refer to the [LICENSE](./LICENSE) file for the full terms. | ||
|
|
||
| ## Maintainers |
There was a problem hiding this comment.
autoformatting stripped spaces in VSCode.
reducedMotion and colorScheme
| executablePath: process.env.CI ? '/usr/bin/google-chrome' : undefined, | ||
| }) | ||
| const contextOptions = authContext?.toPlaywrightBrowserContextOptions() ?? {} | ||
| const contextOptions = { |
There was a problem hiding this comment.
this is not blocking.
Since we're now generating a higher-level context object (that includes auth context and other settings), I think it would be valuable to have a 'contextBuilder' (or whatever you want to call it) that generates the full context outside of this function and passes in 1 context object (maybe even create a specific type of what we expect this context to contain). I would image somewhere in the main function in the index file, something like:
const context = buildFullContext(...whatYouDidHere)
findForUrl(context...)
side-note. this is more of a preference than a suggestion; we don't even have to pass the context down as a param if we don't want to. we can use a provider (contextProvider) that generates the context and caches it, and any function that needs it can import it and read it directly.
| const authContext = new AuthContext(authContextInput) | ||
|
|
||
| const includeScreenshots = core.getInput('include_screenshots', {required: false}) !== 'false' | ||
| const reducedMotionInput = core.getInput('reduced_motion', {required: false}) |
There was a problem hiding this comment.
again, non-blocking. so building on what I said in the comment before - most of this could be moved into a context builder function somewhere and called here.
I also personally find it valuable to wrap input reads in some kind of 'getter' or 'reader' function to isolate how each input is read/parsed (or if an error needs to be thrown, or if we need to transform the input somehow) before being exposed to the rest of the code (here's one similar example - although, this does a few more things than just read the input).
There was a problem hiding this comment.
Yes, once we've trimmed down the list of feature requests I think it would be a good time to do some code maintenance / refactoring (since the scope of the codebase is expanding). Perhaps once we've got your plugin functionality merged? That seems worthy of a major version update.
abdulahmad307
left a comment
There was a problem hiding this comment.
left a couple suggestions. I think they'd be valuable to make. but its your call.
reduced_motionandcolor_scheme🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.