-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Changes from all commits
01ca311
1273ca6
c6c7175
32d4604
985f593
3158287
e3cf2fb
37e6bae
c1268c9
17a661c
f80f350
1b10105
d503ca3
a7ca2e8
2aed4ba
95012a2
70d2999
86d7bbc
2775ab0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -227,6 +227,15 @@ <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> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. use srcdoc instead to avoid the 1-line extra file? :) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That was my first try, didn't work! Not supported I suppose. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
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 - empty-table-header --> | ||
<table> | ||
<tr> | ||
<th></th> | ||
</tr> | ||
</table> | ||
|
||
<!-- Some websites overwrite the original Error object. The captureJSCallUsage function | ||
relies on the native Error object and prepareStackTrace from V8. When overwriting the stack | ||
property the e.stack inside the gatherer won't be in the correct format | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<a href='/'>Home</a> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/** | ||
* @license Copyright 2021 The Lighthouse Authors. All Rights Reserved. | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 | ||
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. | ||
*/ | ||
'use strict'; | ||
|
||
/** | ||
* @fileoverview Ensures table headers have discernible text. | ||
* See base class in axe-audit.js for audit() implementation. | ||
*/ | ||
|
||
const AxeAudit = require('./axe-audit.js'); | ||
const i18n = require('../../lib/i18n/i18n.js'); | ||
|
||
const UIStrings = { | ||
/** Title of an accesibility audit that checks if there are any table headers without visible text. This title is descriptive of the successful state and is shown to users when no user action is required. */ | ||
title: '`table` headers have visible text', | ||
/** Title of an accesibility audit that checks if there are any table headers without visible text. This title is descriptive of the failing state and is shown to users when there is a failure that needs to be addressed. */ | ||
failureTitle: '`table` headers do not have visible text', | ||
/** 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: '`table` headers should have visible text so assistive technologies like screen readers may describe table contents appropriately. [Learn more](https://dequeuniversity.com/rules/axe/4.2/empty-table-header).', | ||
}; | ||
|
||
const str_ = i18n.createMessageInstanceIdFn(__filename, UIStrings); | ||
|
||
class EmptyTableHeader extends AxeAudit { | ||
/** | ||
* @return {LH.Audit.Meta} | ||
*/ | ||
static get meta() { | ||
return { | ||
id: 'empty-table-header', | ||
title: str_(UIStrings.title), | ||
failureTitle: str_(UIStrings.failureTitle), | ||
description: str_(UIStrings.description), | ||
scoreDisplayMode: AxeAudit.SCORING_MODES.INFORMATIVE, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I was out on leave for that PR so I don't have all the background, but today it does seems a little strange to not have it count for anything when passing, even if That said, it seems like our Maybe for now we should drop this audit after all and re-add it when/if it gains some certainty? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
requiredArtifacts: ['Accessibility'], | ||
}; | ||
} | ||
} | ||
|
||
module.exports = EmptyTableHeader; | ||
module.exports.UIStrings = UIStrings; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/** | ||
* @license Copyright 2021 The Lighthouse Authors. All Rights Reserved. | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 | ||
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. | ||
*/ | ||
'use strict'; | ||
|
||
/** | ||
* @fileoverview No `<iframe tabindex=-1>` has focusable content. | ||
* See base class in axe-audit.js for audit() implementation. | ||
*/ | ||
|
||
const AxeAudit = require('./axe-audit.js'); | ||
const i18n = require('../../lib/i18n/i18n.js'); | ||
|
||
const UIStrings = { | ||
/** Title of an accesibility audit that checks if there are any iframes with focusable content that mistakenly set tabindex = -1. This title is descriptive of the successful state and is shown to users when no user action is required. */ | ||
title: '`<iframe>` elements with focusable content do not have a negative `tabindex`', | ||
/** Title of an accesibility audit that checks if there are any iframes with focusable content that mistakently set tabindex = -1. This title is descriptive of the failing state and is shown to users when there is a failure that needs to be addressed. */ | ||
failureTitle: '`<iframe>` elements with focusable content have a negative `tabindex`', | ||
/** 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: 'Focusable elements within an `<iframe>` element with a negative `tabindex` cannot be reached via keyboard navigation. [Learn more](https://dequeuniversity.com/rules/axe/4.2/frame-focusable-content).', | ||
}; | ||
|
||
const str_ = i18n.createMessageInstanceIdFn(__filename, UIStrings); | ||
|
||
class FrameFocusableContent extends AxeAudit { | ||
/** | ||
* @return {LH.Audit.Meta} | ||
*/ | ||
static get meta() { | ||
return { | ||
id: 'frame-focusable-content', | ||
title: str_(UIStrings.title), | ||
failureTitle: str_(UIStrings.failureTitle), | ||
description: str_(UIStrings.description), | ||
requiredArtifacts: ['Accessibility'], | ||
}; | ||
} | ||
} | ||
|
||
module.exports = FrameFocusableContent; | ||
module.exports.UIStrings = UIStrings; |
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.
this needs to be an appropriate use of
aria-labelledby
or this now gets flagged byaria-allowed-attr
. Nice upgrade for that audit