-
Notifications
You must be signed in to change notification settings - Fork 0
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
Filter accessibility violations before unmounting #49
Conversation
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.
Since we are now manipulating the list of reported violations directly in testScenario
, I suggest we make that function return the new violations
array instead of result.violations
.
|
||
let violations = results.violations; | ||
if (shouldIgnoreViolation) { | ||
violations = violations.filter(v => !shouldIgnoreViolation(v)); |
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.
I suppose this may be working due to the overwriting of the violations
reference, but perhaps we should make this function return violations
instead of result.violations
, otherwise it's not super obvious what this if
statement does when overwriting the violations
variable.
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.
Yes, the function should return the filtered violations. Otherwise the change doesn't work at all (!)
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.
As an aside, we currently lack tests for this module which would have made this more obvious.
I spend a few minutes yesterday trying to figure out why the IDs didn't match in hypothesis/client#6620 😅 This is a good catch. |
Change a potentially confusing behavior where components were unmounted before calling the `shouldIgnoreViolation` callback. Querying the rendered tree within the callback, eg. to get the ID of an element to check if a violation relates to it, could fail due to this. Fixes #48.
83d1373
to
2197647
Compare
Change a potentially confusing behavior where components were unmounted before calling the
shouldIgnoreViolation
callback. Querying the rendered tree within the callback, eg. to get the ID of an element to check if a violation relates to it, could fail due to this.Fixes #48.