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

WIP: core(axe): new audits empty-table-header, frame-focusable-content #12536

Closed
wants to merge 19 commits into from

Conversation

connorjclark
Copy link
Collaborator

@connorjclark connorjclark commented May 22, 2021

Many bug fixes. A few new rules.

Need web.dev pages ... OR (hear me out...) we just link to axe docs...

@connorjclark connorjclark requested a review from a team as a code owner May 22, 2021 00:59
@connorjclark connorjclark requested review from patrickhulce and removed request for a team May 22, 2021 00:59
@google-cla google-cla bot added the cla: yes label May 22, 2021
@connorjclark connorjclark changed the title WIP: deps(axe-core): upgrade to 4.2.1 deps(axe-core): upgrade to 4.2.1 May 22, 2021
@@ -2016,33 +2114,32 @@
],
"incomplete": [
{
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

dunno why color-contrast went bye-bye

Copy link
Member

Choose a reason for hiding this comment

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

dunno why color-contrast went bye-bye

hmm, didn't this change once before?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

oh i guess it did and we decided to manually keep it around?

failureTitle: '`role=text` elements should not have focusable descendants',
// TODO: need web.dev article.
/** 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: 'Browsers may ignore `role=text` if it contains focusable descendants.',
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
description: 'Browsers may ignore `role=text` if it contains focusable descendants.',
description: 'Browsers may ignore elements with `role=text` if they contain focusable descendants.',

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

hmm not sure on this one. browsers ignore the element _as far as role=text is concerned, which is why I put the focus on that. The element still exists, is visible, etc. so it isn't entirely ignored :)

lighthouse-core/audits/accessibility/aria-text.js Outdated Show resolved Hide resolved
lighthouse-core/audits/accessibility/aria-text.js Outdated Show resolved Hide resolved
lighthouse-core/audits/accessibility/empty-table-header.js Outdated Show resolved Hide resolved
lighthouse-core/audits/accessibility/aria-text.js Outdated Show resolved Hide resolved
lighthouse-core/audits/accessibility/nested-interactive.js Outdated Show resolved Hide resolved
lighthouse-core/audits/accessibility/nested-interactive.js Outdated Show resolved Hide resolved
lighthouse-core/audits/accessibility/nested-interactive.js Outdated Show resolved Hide resolved
lighthouse-core/config/default-config.js Outdated Show resolved Hide resolved
@@ -225,6 +225,21 @@ <h2>Do better web tester page</h2>
<button class="small-button">Do something</button>
<button class="small-button">Do something else</button>

<!-- FAIL - frame-focusable-content -->
<iframe tabindex="-1" src="focusable-iframe.html"></iframe>
Copy link
Collaborator

Choose a reason for hiding this comment

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

use srcdoc instead to avoid the 1-line extra file? :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

That was my first try, didn't work! Not supported I suppose.

Copy link
Member

Choose a reason for hiding this comment

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

That was my first try, didn't work! Not supported I suppose.

interesting, are srcdoc iframes a unique origin and so not available in the parent via js (so axe wouldn't be able to see inside)?

<!-- FAIL - aria-text -->
<div role="text">
Still an <a href="#">interactive link</a> because of the author error.
</div>
Copy link
Member

Choose a reason for hiding this comment

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

move to a11y_tester with the other accessibility smoke tests?

Copy link
Collaborator Author

@connorjclark connorjclark May 24, 2021

Choose a reason for hiding this comment

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

These are here to populate the sample LHR. Do we care about coverage there?

Copy link
Member

Choose a reason for hiding this comment

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

These are here to populate the sample LHR. Do we care about coverage there?

ah, got it. Ideally yes, so maybe just duplicate in there? It's very helpful to have yarn smoke a11y cover (almost?) everything in the accessibility category

lighthouse-core/gather/gatherers/accessibility.js Outdated Show resolved Hide resolved
Comment on lines 314 to 315
// TODO .lh-category-wrapper:nth-child(2) > .lh-category > .lh-clump--manual.lh-clump.lh-audit-group > summary
'nested-interactive': {enabled: false},
Copy link
Member

Choose a reason for hiding this comment

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

I guess this is the selector of the failure? This is going to be lost down here. How hard is the fix?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I don't know, it was Friday evening, this PR got big, and I just wanted to expedite feedback (since I knew there'd be quite a bit).

don't plan on pushing this PR w/o looking into this more. looks fun.

Copy link
Collaborator Author

@connorjclark connorjclark May 24, 2021

Choose a reason for hiding this comment

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

https://dequeuniversity.com/rules/axe/4.2/nested-interactive

so it seems that this rule fails b/c summary containing a link :/

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think this rule is not ready for LH–should we hide it, keep it to zero weight, or delete?

Copy link
Member

Choose a reason for hiding this comment

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

I think this rule is not ready for LH–should we hide it, keep it to zero weight, or delete?

I vote we delete it and aria-text but leave a TODO for nested-interactive so we update it next time if ready

Co-authored-by: Patrick Hulce <patrick.hulce@gmail.com>
<!-- FAIL - aria-text -->
<div role="text">
Still an <a href="#">interactive link</a> because of the author error.
</div>
Copy link
Member

Choose a reason for hiding this comment

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

These are here to populate the sample LHR. Do we care about coverage there?

ah, got it. Ideally yes, so maybe just duplicate in there? It's very helpful to have yarn smoke a11y cover (almost?) everything in the accessibility category

@@ -225,6 +225,21 @@ <h2>Do better web tester page</h2>
<button class="small-button">Do something</button>
<button class="small-button">Do something else</button>

<!-- FAIL - frame-focusable-content -->
<iframe tabindex="-1" src="focusable-iframe.html"></iframe>
Copy link
Member

Choose a reason for hiding this comment

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

That was my first try, didn't work! Not supported I suppose.

interesting, are srcdoc iframes a unique origin and so not available in the parent via js (so axe wouldn't be able to see inside)?

'use strict';

/**
* @fileoverview Ensures `role=text` is only used on elements with no focusable descendants.
Copy link
Member

Choose a reason for hiding this comment

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

Rob seemed like he was lukewarm about some of the possible aria-text gotchas and it's a best-practice, not wcag2a or wcag2aa. Should we drop for now?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

rob said:

aria-text is kind of news to me and looks like it has a potential gotcha (like if you have a link inside of the heading) so...hm...idk

i said:

apparently aria-label is the role to use if element has focusable elements, not aria-text. altho TIL role=text isnt standard yet? https://incl.ca/roletext-presently-kinda-not-thing-sorta/#:~:text=here-,role%3D%22text%22%20isn,While,-that

or are you referring to something else?

role=text not being standard seems like a convincing reason to drop/hide/0-weight it.

Copy link
Member

Choose a reason for hiding this comment

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

yes, that's what I was trying to summarize without using many braincells, apparently :)


const str_ = i18n.createMessageInstanceIdFn(__filename, UIStrings);

class NestedInteractive extends AxeAudit {
Copy link
Member

Choose a reason for hiding this comment

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

if nested-interactive is problematic, I say we just put 'nested-interactive': {enabled: false}, in accessibility.js and put a TODO linked to your dequelabs/axe-core#2958. Looking at the history of nested-interactive, the discussion seems to be all around <button> and e.g. links inside elements that are role="checkbox", but then it became all presentational elements. We thought we were doing well in the report with our <details>, so I think in this case we at least need to figure out how we fix ourselves before we demand other people fix their own sites :)

lighthouse-core/audits/accessibility/empty-table-header.js Outdated Show resolved Hide resolved
lighthouse-core/audits/accessibility/empty-table-header.js Outdated Show resolved Hide resolved
@@ -2016,33 +2114,32 @@
],
"incomplete": [
{
Copy link
Member

Choose a reason for hiding this comment

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

dunno why color-contrast went bye-bye

hmm, didn't this change once before?

Co-authored-by: Brendan Kenny <bckenny@gmail.com>
@brendankenny
Copy link
Member

brendankenny commented May 27, 2021

@connorjclark @patrickhulce I think the main last thing here is deciding if we want to keep empty-table-header and frame-focusable-content in the 8.0 release. To summarize:

  • frame-focusable-content: from the axe test cases for it it does seem able to fail, but I can't get it to, even c/p the tests. Figure out how to make it fail? File a bug? Drop for now?

  • empty-table-header never fails, it only goes pass/incomplete/notApplicable. Since it's informative (based on what we did in core(audits): add handling of 'incomplete' results from axe-core #10072), it will show the error on incomplete, but the best the error message ever will be (with current axe) is Fix any of the following:\n Unable to determine if element has children.

    edit: actually, we don't show that explanation (that's Better error messages in a11y test #12282), so the incomplete result isn't that bad. Weird that it's not scored for clear cases like the empty <th> though:

    example Lighthouse output of empty-table-header audit

@patrickhulce
Copy link
Collaborator

frame-focusable-content: from the axe test cases for it it does seem able to fail, but I can't get it to, even c/p the tests. Figure out how to make it fail? File a bug? Drop for now?

Given time before 8.0, I'd say drop for now. We can always bring it back in a point release later.

empty-table-header never fails, it only goes pass/incomplete/notApplicable. Since it's informative (based on what we did in #10072), it will show the error on incomplete, but the best the error message ever will be (with current axe) is Fix any of the following:\n Unable to determine if element has children.

Does this mean even when the table header has text, it gets marked as incomplete? Or are you saying that in every case where it should be failing it shows up as incomplete instead? (Or somewhere in between) If it's just that the failing case is replaced with incomplete, I think that's fine. It's a bit weird to not be afailure but maybe it's not as big a deal 🤷 If it's any of the other two options. I'd also say drop.

@brendankenny
Copy link
Member

Does this mean even when the table header has text, it gets marked as incomplete? Or are you saying that in every case where it should be failing it shows up as incomplete instead? (Or somewhere in between) If it's just that the failing case is replaced with incomplete, I think that's fine. It's a bit weird to not be afailure but maybe it's not as big a deal 🤷 If it's any of the other two options. I'd also say drop.

#10072 is a bit weird. The idea was that for axe rules that can't fail but get marked incomplete because they may be failing, we should make them scoreDisplayMode 'informative' so they'll still be shown on failure but not scored (since they might not be failing). That part is fine, but the passing case gets marked notApplicable, which is kind of weird because if you have a table with header text you think you should get the credit of passing 🤷

So in all it means

  • passing (but 0 weight) if you don't have any tables with headers (th or aria-based)
  • informative if you may have failed (with the result looking like the screenshot above)
  • notApplicable if you do have a table with a header with proper text

all that's fine, I guess? It's not part of wcag2a or wcag2aa which is why I'm more inclined to drop it, but I also understand the "that's fine" argument too :)

@patrickhulce
Copy link
Collaborator

passing (but 0 weight) if you don't have any tables with headers (th or aria-based)
informative if you may have failed (with the result looking like the screenshot above)
notApplicable if you do have a table with a header with proper text

lol so they flipped passing and notApplicable on this rule. I'd vote file a bug with axe and implement later if it's fixed.

@connorjclark connorjclark changed the title deps(axe-core): upgrade to 4.2.1 WIP: add new axe audits Jun 1, 2021
@patrickhulce
Copy link
Collaborator

When we get back to this we should add an audit for select-name (fixes #12639). Seems like an oversight that this got missed. Maybe we should add an assertion that every axe rule that we're running has an audit?

@jayaddison
Copy link
Contributor

So in all it means

* passing (but 0 weight) if you don't have any tables with headers (`th` or aria-based)

* informative if you may have failed (with the result looking like the screenshot above)

* notApplicable if you do have a table with a header with proper text

👋 hey @connorjclark @patrickhulce - I noticed this while looking back through some GitHub history.

After refreshing my memory and reading this thread, case three above (informative rule, passing elements on the page) does read as non-ideal. The relevant conditional is https://github.com/GoogleChrome/lighthouse/pull/10072/files#diff-7f8ed664776e43a5b44d4db584f9b7d12f8ce6a0588cd40ac3ed6338e6627dddR64.

I remember passes not being present in the Accessibility result structure, and at some point I was experimenting with adding that, before removing it again nearish merge time.

Footnotes:

  • I'm not sure I was (or am) best equipped to help out, but do feel an obligation to offer maintenance, so let me know if I can help (not required by any means, especially if this is further distraction).
  • core(audits): add handling of 'incomplete' results from axe-core #10072 was noisy, sorry about that
  • This comment is perhaps slightly defensive, but I do worry that I've potentially broken or downscored pages here, and that's ungreat

@brendankenny
Copy link
Member

brendankenny commented Jun 19, 2021

Really sorry if my comment came across as criticizing. The thing I was trying to say (but reading back, it's a bit too implicitly stated) is that the change was necessary to handle incomplete results, but that the notApplicable part left a subset of results from a single axe rule in a weird state because axe has one way of marking results as possible but not (currently) verifiable problems and lighthouse has its own way of doing the same, but they're not quite compatible. So sometimes you end up in this technically correct but hard to diagnose state for that one audit (two when we land empty-table-header).

I didn't raise any alarms specifically because this only affects form-field-multiple-labels and the audit is unscored no matter its result since it's scoreDisplayMode: 'informative', so we don't have to worry about any regression or anything.

Your thoughts on resolving the third state sound good to me, and maybe there's more we can do to help future updaters of axe in Lighthouse with knowing when to mark an audit informative, if only to shorten the process of trying to add every permutation of a test and having no clue as to why they cannot get that audit to fail :)

@brendankenny
Copy link
Member

brendankenny commented Jun 19, 2021

And there have been several people in the accessibility gatherer and axe-audit recently and have them fresh in our minds, so I don't think there's any problem with one of us taking the change (unless you want to) and hopefully we can just rope you in for consultation, if you have the time.

@jayaddison
Copy link
Contributor

jayaddison commented Jun 19, 2021

Thanks @brendankenny - nope, no problem in your messaging at all - I was worried by the idea of #10072 having had a wide negative impact, but am glad to hear and see that the number of informative rules is small. Phew :)

And yep, I recall that kind of venn-diagram-matching problem re: the slight differences between the way the two libraries model the world. A lot of my unease, I think, was that I'd lost whatever context I had since then, and that perhaps I hadn't understood the problem properly (still possible!).

I'll probably gladly opt-out of any further changes for now, a bit less time nowadays. Thank you though :)

@connorjclark connorjclark changed the title WIP: add new axe audits WIP: core(axe): new audits empty-table-header, frame-focusable-content Nov 1, 2021
@patrickhulce patrickhulce removed their assignment Nov 15, 2021
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.

5 participants