Skip to content
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

new_audit: add new accessibility audits #9798

Merged
merged 10 commits into from
Oct 25, 2019
Merged

new_audit: add new accessibility audits #9798

merged 10 commits into from
Oct 25, 2019

Conversation

brendankenny
Copy link
Member

fixes #7127
fixes #9794 (?)
part of #9774

These are mostly part of the wcag2a/wcag2aa tags, we just had them turned off before since we didn't have any audits that used the results.

This is part of the 6.0 push, so can't land until we're ready to make that break, but we've needed lots of time in the past to go over phrasing, associated docs, etc.

One issue is not all these things can be tested together in the smoke tests. Specifically

  • adding an aria-hidden to the <body to fail the aria-hidden-body breaks most other audit failures as hidden stuff usually isn't considered
  • adding an xml:lang to fail html-xml-lang-mismatch breaks the other lang audit failures

I've left those as notApplicable rather than break other stuff and these are (probably?) relatively rare things.

In addition, messing with <h1>, etc to fail heading-order makes it so bypass doesn't fail. heading-order is looking to be pretty important (see #9794), so bypass now passes.

Originally I made a second a11y_tester to test these things, but <body aria-hidden="true"> alone makes most other tests notApplicable, so it didn't seem worth the large increase in smoke test execution time. Happy to look at other tradeoffs, though.

@brendankenny
Copy link
Member Author

oh, and I used the axe doc links for now, but happy to switch before landing to new docs or land and then switch the docs later.

cc @mfriesenhahn

@mfriesenhahn
Copy link
Collaborator

oh, and I used the axe doc links for now, but happy to switch before landing to new docs or land and then switch the docs later.

I'm writing the docs as we speak, so I think we'll be able to switch the links before landing. If you don't mind granting me access, I can do that directly and fix some typos I found.😄

Copy link
Collaborator

@patrickhulce patrickhulce left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sweet! I think the current smoketest tradeoffs all make sense to me 👍

'aria-hidden-body': {
score: 1,
details: {
'type': 'table',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the lint in this file is going to be fun :)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

whaaaaa... how is this allowed!?

'type'
'headings'

madness!

Copy link
Member Author

@brendankenny brendankenny Oct 16, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

whaaaaa... how is this allowed!?

ohhh, I see what your comment means now. I'm not sure how it's allowed, but it's how all of them are written...

@@ -259,6 +394,10 @@ const expectations = [
],
},
},
'html-xml-lang-mismatch': {
score: null,
scoreDisplayMode: 'notApplicable',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we specifically assert notApplicable of other a11y audits in here?

I'm just wondering aloud if this is really worth having in here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we specifically assert notApplicable of other a11y audits in here?

I'm just wondering aloud if this is really worth having in here.

I I think so. It is asserting that they're specifically notApplicable, which is different than pass (obvs) and fail, which is unfortunately indistinguishable from not having run that test at all. So it is at least testing that the check is running and passing down results.

It also plainly lists the audits that don't have their failure path exercised, and someone making a future second accessibility smoke test can start with those.

All that and more for four extra lines in the expectations file :)

/** Title of an accesibility audit that checks if the html <body> element does not have an aria-hidden attribute set on it. This title is descriptive of the failing state and is shown to users when there is a failure that needs to be addressed. */
failureTitle: '`[aria-hidden="true"]` is present on the document `<body>`',
/** Description of a Lighthouse audit that tells the user *why* they should try to pass. This is displayed after a user expands the section to see more. No character length limits. 'Learn More' becomes link text to additional documentation. */
description: 'Assistive technologies, like screen readers, work inconsistently when `aria-hidden="true"` is set on the document `<body>`. [Learn more](https://dequeuniversity.com/rules/axe/3.3/aria-hidden-body).',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems odd that it would even be allowed since aria is all about assistive technology hints haha

lighthouse-core/audits/accessibility/aria-hidden-focus.js Outdated Show resolved Hide resolved
lighthouse-core/audits/accessibility/heading-order.js Outdated Show resolved Hide resolved
@brendankenny
Copy link
Member Author

suggestions have all be really good, thanks!

@mfriesenhahn
Copy link
Collaborator

Hey, @brendankenny, I noticed an audit name discrepancy: axe has aria-toggle-field-label, while this PR has aria-toggle-field-name. Is that deliberate?

@brendankenny
Copy link
Member Author

Hey, @brendankenny, I noticed an audit name discrepancy: axe has aria-toggle-field-label, while this PR has aria-toggle-field-name. Is that deliberate?

yes, sorry, should have flagged this. I'm not sure what the deal is...in their code the axe audit is definitely named aria-toggle-field-name, but their docs list it as aria-toggle-field-label. I haven't looked into why that is or if anyone else has noticed the problem.

@brendankenny
Copy link
Member Author

ah, looks like it was dequelabs/axe-core#1656 that renamed to aria-toggle-field-name but the

[x] Has documentation updated, a DU ticket, or requires no documentation change

checked box was incorrect :)

@mfriesenhahn
Copy link
Collaborator

Cool, aria-toggle-field-name it is!

@mfriesenhahn
Copy link
Collaborator

Sorry, another question. Here's my understanding of the duplicate ID audits:

  • duplicate-id-active checks for duplicate IDs in focusable elements.
  • duplicate-id-aria checks for duplicate IDs in elements referred to in an aria-labelledby attribute on another element. It does not check duplicates for elements with a role or with an aria-label attribute.
  • duplicate-id checks everything else, including elements with ARIA roles.

If that's right, it strikes me as pretty complex. I'm inferring that axe separated these out because they deemed duplicate-id less critical than the other two, but I'm having trouble formulating an argument to support that position.

What would you think about rolling these three axe audits into a single LH audit? I think that'd make it easier to understand and fix errors, FWIW.

And I kinda want to make the same argument about aria-toggle-field-name and aria-input-field-name. Like, at a certain point, granularity makes it harder to grasp broader concepts (e.g., make sure everything has an accessible name).

@brendankenny
Copy link
Member Author

after various conversations with @mfriesenhahn and @robdodson, this is the plan we've landed on. Let me know if I've missed anything:

  • remove the manual heading-levels audit now that we'll have the non-manual heading-order
  • remove old catch-all duplicate-id which fails you even if the duplicate ids won't matter for accessibility purposes (ahem). The new duplicate-id-* audits are more focused on specific harmful cases
  • don't include html-xml-lang-mismatch after all; it's super niche
  • point descriptions to new web.dev docs being written in Lighthouse a11y updates web.dev#1648, which will likely land before this PR

@@ -1,38 +1,36 @@
/**
* @license Copyright 2017 Google Inc. All Rights Reserved.
* @license Copyright 2019 Google Inc. All Rights Reserved.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

after deleting duplicate-id.js git now thinks this was a move + slight change for this file, which is distracting for review but w/e

@robdodson
Copy link
Contributor

I think that sounds ok

Copy link
Collaborator

@patrickhulce patrickhulce left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM % title prefix business

'aria-hidden-body': {
score: 1,
details: {
'type': 'table',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

whaaaaa... how is this allowed!?

'type'
'headings'

madness!

/** Title of an accesibility audit that checks that all ARIA input fields have an accessible name. This title is descriptive of the successful state and is shown to users when no user action is required. */
title: 'All ARIA input fields have accessible names',
/** Title of an accesibility audit that checks that all ARIA input fields have an accessible name. This title is descriptive of the failing state and is shown to users when there is a failure that needs to be addressed. */
failureTitle: 'Not all ARIA input fields have accessible names',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
failureTitle: 'Not all ARIA input fields have accessible names',
failureTitle: 'ARIA input fields do not have accessible names',


const UIStrings = {
/** Title of an accesibility audit that checks that all ARIA input fields have an accessible name. This title is descriptive of the successful state and is shown to users when no user action is required. */
title: 'All ARIA input fields have accessible names',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the All prefixes feel out of place compared to most of our audit titles, we only do it twice out of ~100+ audits and those two were external contribs we should probably fix. it's implied in our results that we looked at everything :)

Suggested change
title: 'All ARIA input fields have accessible names',
title: 'ARIA input fields have accessible names',


const UIStrings = {
/** Title of an accesibility audit that checks that all ARIA toggle fields have an accessible name. This title is descriptive of the successful state and is shown to users when no user action is required. */
title: 'All ARIA toggle fields have accessible names',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
title: 'All ARIA toggle fields have accessible names',
title: 'ARIA toggle fields have accessible names',

/** Title of an accesibility audit that checks that all ARIA toggle fields have an accessible name. This title is descriptive of the successful state and is shown to users when no user action is required. */
title: 'All ARIA toggle fields have accessible names',
/** Title of an accesibility audit that checks that all ARIA toggle fields have an accessible name. This title is descriptive of the failing state and is shown to users when there is a failure that needs to be addressed. */
failureTitle: 'Not all ARIA toggle fields have accessible names',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
failureTitle: 'Not all ARIA toggle fields have accessible names',
failureTitle: 'ARIA toggle fields do not have accessible names',

/** Title of an accesibility audit that evaluates if there are any duplicate id HTML attributes on the page. This title is descriptive of the failing state and is shown to users when there is a failure that needs to be addressed. */
failureTitle: '`[id]` attributes on the page are not unique',
/** Title of an accesibility audit that checks if there are any duplicate ARIA IDs on the page. This title is descriptive of the successful state and is shown to users when no user action is required. */
title: 'All ARIA IDs are unique',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
title: 'All ARIA IDs are unique',
title: 'ARIA IDs are unique',

/** Title of an accesibility audit that checks if there are any duplicate ARIA IDs on the page. This title is descriptive of the successful state and is shown to users when no user action is required. */
title: 'All ARIA IDs are unique',
/** Title of an accesibility audit that checks if there are any duplicate ARIA IDs on the page. This title is descriptive of the failing state and is shown to users when there is a failure that needs to be addressed. */
failureTitle: 'ARIA IDs are not all unique',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
failureTitle: 'ARIA IDs are not all unique',
failureTitle: 'ARIA IDs are not unique',


const UIStrings = {
/** Title of an accesibility audit that checks if any form fields have multiple label elements. This title is descriptive of the successful state and is shown to users when no user action is required. */
title: 'No Form fields have multiple labels',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
title: 'No Form fields have multiple labels',
title: 'No form fields have multiple labels',

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

new audit: hierarchy of headings evaluate new axe audits for inclusion
6 participants