Comments (6)
I had thought of this previously, but never implemented it for a couple reasons:
- It would break backwards compatibility.
- Frames. If you specify a context that is inside a frame, we would need to make this determination inside the frame and then pass that back up to the initiating frame.
Due to the fact that it would be completely backwards incompatible, it is not likely that axe.a11yCheck
will ever follow this pattern.
We could, however add a completely new method that follows Node conventions; but it would be a non-trivial effort to capture all the possible error conditions and ensure they are passed back alongside results.
from axe-core.
It would break backwards compatibility.
Yep, totally. A new method would be necessary, or at the very least, making the change only in a major release.
but it would be a non-trivial effort to capture all the possible error conditions and ensure they are passed back alongside results.
I'm not sure I follow this. In node, you usually get an error or results. Since you can't throw an exception when running async, the error
parameter is a replacement for an exception. And, like normal error handling, you either have an exception or you have success. So I guess the question is: how are errors handled now? It can't be exceptions since it's async. And there isn't a parameter in the callback. So does that mean there currently isn't a way to have an error condition at all? Or is an error signified by an empty results object?
from axe-core.
It just logs errors to the console; which is not great, but at least you can see them. We purposely do not throw exceptions because of the nature of the DOM. Weird things can happen and prototypes can be clobbered, so it is important that a single failing Check doesn't stop execution.
A good example of an exception we can't really prevent is if a <form>
has elements whose id maps to native DOM properties:
<form id="something">
<input name="id" type="hidden">
</form>
When rules that need to look at the ID of elements will choke when form.id
is actually a reference to the hidden input.
The conditions which you pointed out would be useful:
- No matching include
- No matching rules (
runOnly
)
In addition there are a few more error conditions with frames:
- When an iframe does not have axe injected. relevant code
- When there is an error that prevents results from returning from a frame. relevant code
- Weird Firefox condition where an iframe does not have a content window. relevant code
Additionally there are other exceptions that might occur with Rules and Checks:
- Exceptions in Check's
evaluate
function. relevant code - Exceptions in a Check's custom
matches
function. (not caught) - Exceptions in a Rule's custom
matches
function. (not caught)
from axe-core.
Wanted to share another reason that would make the node-style preferable: promises.
Nearly every promise library out there has some form of denodeify method that can be used to seamlessly convert a callback-accepting function into a promise-returning function. These denodeify helpers only work, of course, when the callback follows the error-first node convention. Without the node-style callback, a11yCheck
can't be converted to promises automatically, but must be done manually.
To the error handling side of things. Since a11yCheck
is not currently throwing exceptions, it could continue to behave as it is now. That is, the callback could be converted to error-first style, but simply never call the callback with an error (for now). It would still be a BC-breaking change, but wouldn't require restructuring the error handling (yet).
from axe-core.
DECISION: We will implement this as a new API for doing the audit. The existing API will be built on top of this new API to ensure backwards compatibility. Still trying to determine the feasibility of cascading errors up from all the iframes.
from axe-core.
This has been implemented with axe.run()
. The axe.a11yCheck
API is being deprecated.
from axe-core.
Related Issues (20)
- Investigate supporting partially obscured elements in color-contrast
- label-content-name-mismatch should ignore SVG titles HOT 1
- Add summary-name rule HOT 1
- getting document-title violation when scanned code uses title in head. HOT 2
- Lighthouse flags 1x1 tracking pixels under the 'image elements do not have [alt] attribute' HOT 4
- Should role=slider allow aria-valuetext as an alternative to aria-valuenow?
- Add accessible description algorithm
- Empty elements referenced by aria-labelledby should fail
- Testing iframes with Playwright/axe-core HOT 5
- Deprecated rules shouldn't run if their WCAG tag is configured
- object-is-loaded-matches test flakiness in nightly CI builds HOT 1
- aria-haspopup depricated from global attributes HOT 1
- Pseudo element on cousin not recognized as giving a background
- scrollable-region-focusable should consider an element's content real content, not its content box
- Should text nodes be ignored by aria-required-children?
- Runtime issue: Result for unknown rule. You may be running mismatch axe-core versions HOT 1
- isVisibleOnScreen overflowHidden method does not take into account position parents
- Stacking order bug causes color-contrast to misidentify background
- Stacking-order z-index: 0 bug causes color-contrast to misidentify background
- Option to truncate excessively large `.html` in results 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 axe-core.