Comments (4)
This issue has been marked as ready for team triage; we will triage it in our weekly review and update the issue. Thank you for contributing to Accessibility Insights!
from accessibility-insights-action.
The Accessibility Insights team has received several upvotes for this issue over the course of several months, and will be investigating a solution.
from accessibility-insights-action.
Problematic Scenario
The most common scenario that we have come across that causes this issue is CSS selectors being auto-generated in a non-deterministic manner by webpack or other build processes.
For example, an element and CSS class may look like this in the source code:
<p class="test-class">Hello World</p>
And once built, the build process will append a random string to the end of the class (-Gz1t
in this case)
<p class="test-class-Gz1t">Hello World</p>
This randomly generated string changes on every build, causing mismatches in the baseline file each time.
Possible Solutions/Workarounds
Adding an id/class/attribute to uniquely identify problematic element
Axe, the accessibility scanning engine used by Accessibility Insights, uses a hierarchy of possible selectors to uniquely represent an element. If a unique selector is found on any step of the hierarchy it will use that selector and skip the rest of the hierarchy.
The hierarchy used is as follows:
- If an element has an
id
which is unique with the page - Class names which are unique within the page
- Custom attributes which are unique with in the page
- Custom complex selector using classes and attributes of the element and it's ancestors
If you're able to give the problematic element(s) a unique id or css class name which is not modified on build, Axe can use that selector instead of the auto-generated one.
Modifying build strategy
Depending on your project and build setup, you may be able to use a different strategy for how the build process generates selector names. For example, our own webpack settings for our CSS modules uses something like this:
{
loader: 'css-loader',
options: {
esModule: true,
modules: {
localIdentName: '[local]--[hash:base64:5]'),
}
}
}
This produces deterministic selector names as long as the contents of the individual CSS module in question are unchanged. This would still cause the baseline to break if the contents of the module are changed, but it would still be a drastic improvement over breaking every build even when no source changes occur.
from accessibility-insights-action.
Unfortunately, this is out of scope given our current priorities.
Thanks for using Accessibility Insights!
from accessibility-insights-action.
Related Issues (20)
- Consider clarifying service account name and password labels HOT 2
- Cannot add task in a classic pipeline without setting Authentication type
- Add input to adjust the zoom level for the page(s) to be scanned HOT 2
- Emit warning or error when the extension unknowingly scans the login page HOT 2
- Accessibility-insights for azure devops not working and throw exception HOT 6
- ADO extension fails when run in a container: handleRequestFunction failed, { message: 'read ECONNRESET' } HOT 8
- Improve Release pipeline support HOT 3
- My tests keep timing out at 180 seconds despite increasing scanTimeout HOT 10
- ADO Extension should support nested directories for outputDir
- Support authentication against PPE AAD login endpoint HOT 4
- Error: "pQuerySelectorAll is not a function" HOT 3
- Troubling messages in build output
- [Feature request]: Normalize GUIDs in baselines HOT 7
- Problem with inputurls if auth is enabled HOT 2
- `failOnAccessibilityError` does not work with `baselinefile` HOT 1
- Password step of authentication failing in ADO extension HOT 1
- Supporting Single Page App for crawler with # in the inputUrl HOT 1
- Allow for both `failOnAccessibilityError` and `baseline` flags to work at the same time HOT 1
- Navigation timeout is not configurable
- TypeError: Cannot read property 'baseUrl' of undefined HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from accessibility-insights-action.