-
Notifications
You must be signed in to change notification settings - Fork 776
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
Decorative images should be ignored by the region rule #4145
Comments
Doesn't the |
@professorplumb Unfortunately there is no way to tell axe-core to ignore a specific violation, nor is there a good way for axe-core to detect the purpose of these tracking pixels from the markup alone to know to exclude them from the rule itself. But as @sorin-davidoi has suggested, one way you can have axe-core not report the issue is to use the |
You shouldn't have to exclude these elements. Axe-core is in error in failing these under the |
Thanks @WilcoFiers - having the @straker @sorin-davidoi appreciate the reference to the |
We received a new +1 of this issue in a customer support ticket today |
added isPresentationGraphic check which currently only handles alt='' and ignores them for the region rule svg I believe is handled differently already role='presentation' test added as well, use-case already handled fix: #4145
my IDE was adding tabs ew, replaced with spaces Refs: #4145
Issue was around [decorative images](https://www.w3.org/WAI/tutorials/images/decorative/), specifically 1 pixel wide/tall marketing tracking images, that get added outside of regions failing the region rule. An easy and fairly robust solution [the issue opener agreed with](#4145 (comment)) was ignoring images with `alt=''` and so that's what this PR implements. Dev notes: - Added `isPresentationGraphic/1` check which currently only handles `alt=''` and ignores them for the region rule - role='presentation' test added as well, but this already worked previously prior to this code change - svg I believe is handled differently already, there's a test called `treats svg elements as regions` so the new function doesn't check for svg's fix: #4145
Product
axe-core
Question
Like many website operators, we use "marketing pixels" to track page hits and conversions. These are usually
img
tags with a height and width of 1 and asrc
URL which points to a marketing partner's site and through which affiliate metrics are tracked.These might look something like
Since they're often created by a third-party script, the script usually auto-appends them to the
body
tag. Because they're not inside a landmark region, they're called out by axe-core'sregion
rule.My question is: is there any way to get axe-core to ignore these pixels being outside a landmark region? The purpose of the rule - to have all consumable content inside landmark regions for screen reader navigation - doesn't apply, since these pixels aren't intended to be viewed by any users at all. (Most have
alt=""
to cause screen readers to ignore them.)I could see a few ways to update axe-core to accommodate this:
height="1" width="1"
(or withalt=""
, or both) from theregion
rule.ignoreIfMatches: [{ rule: 'region', elementRegex: '/img src.*height="1" width="1".*\/>/' }]
.I'm aware that we can also fix these violations by appending the pixel to e.g. the end of the
main
element instead of thebody
. We don't always control the script which adds them, though, and we'd love to be able to ignore these in our accessibility audits.The text was updated successfully, but these errors were encountered: