-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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: table-fake-caption, html-xml-lang-mismatch, input-button-name #15098
Merged
Merged
Changes from 16 commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
3419062
add table-fake-caption
jazyan 919856d
update lint and flow
jazyan d86313a
add audit file
jazyan e52529b
update pptr snapshot and table-fake-caption comment
jazyan 87c58aa
add table-fake-caption smoke expectations and alphabetize a11y rules
jazyan 9dec775
add html-xml-lang-mismatch
jazyan dd65c30
lint + update json and tests
jazyan a1ef197
add frame-focusable-content
jazyan df8d604
update sample json and add wrongly passing smoke test for frame-focus…
jazyan a0b058d
Merge branch 'main' into enable-more-axe
jazyan d6e4afc
auditResults.length + 3 for devtools e2e
jazyan 998e7f7
Merge branch 'enable-more-axe' of github.com:GoogleChrome/lighthouse …
jazyan 694f90e
remove frame-focusable-content and add input-button-name
jazyan 09ec9a0
update pptr snapshot and test
jazyan 9ca6faa
Merge branch 'main' into enable-more-axe
jazyan 664609e
fix aria-allowed-attr test
jazyan 1fce40e
Apply suggestions from code review
jazyan 094977f
update strings and html-xml comments
jazyan fc1c184
update html-xml failure message as well
jazyan b6891fd
Merge branch 'main' into enable-more-axe
jazyan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,47 @@ | ||||||||||
/** | ||||||||||
* @license Copyright 2023 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. | ||||||||||
*/ | ||||||||||
|
||||||||||
/** | ||||||||||
* @fileoverview Ensures that, if present, the `[xml:lang]` attribute value in an HTML document has | ||||||||||
* the same value as the `[lang]` attribute. | ||||||||||
* See base class in axe-audit.js for audit() implementation. | ||||||||||
*/ | ||||||||||
|
||||||||||
import AxeAudit from './axe-audit.js'; | ||||||||||
import * as i18n from '../../lib/i18n/i18n.js'; | ||||||||||
|
||||||||||
const UIStrings = { | ||||||||||
/** Title of an accesibility audit that evaluates if the xml:lang attribute, if present, has the same value as the `lang` attribute. This title is descriptive of the successful state and is shown to users when no user action is required. */ | ||||||||||
title: '`<html>` element has an `[xml:lang]` attribute with the same value as the `[lang]` ' + | ||||||||||
'attribute.', | ||||||||||
jazyan marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||
/** Title of an accesibility audit that evaluates if the xml:lang attribute, if present, has the same value as the `lang` attribute. This title is descriptive of the failing state and is shown to users when there is a failure that needs to be addressed. */ | ||||||||||
failureTitle: '`<html>` element does not have an `[xml:lang]` attribute with the same value ' + | ||||||||||
'as the `[lang]` attribute.', | ||||||||||
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.
Suggested change
|
||||||||||
/** 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. The last sentence starting with 'Learn' becomes link text to additional documentation. */ | ||||||||||
description: 'If the webpage does not specify a consistent language, then the screen ' + | ||||||||||
'reader might not announce the page\'s text correctly. ' + | ||||||||||
'[Learn more about the `lang` attribute](https://dequeuniversity.com/rules/axe/4.7/html-xml-lang-mismatch).', | ||||||||||
}; | ||||||||||
|
||||||||||
const str_ = i18n.createIcuMessageFn(import.meta.url, UIStrings); | ||||||||||
|
||||||||||
class HTMLXMLLangMismatch extends AxeAudit { | ||||||||||
/** | ||||||||||
* @return {LH.Audit.Meta} | ||||||||||
*/ | ||||||||||
static get meta() { | ||||||||||
return { | ||||||||||
id: 'html-xml-lang-mismatch', | ||||||||||
title: str_(UIStrings.title), | ||||||||||
failureTitle: str_(UIStrings.failureTitle), | ||||||||||
description: str_(UIStrings.description), | ||||||||||
requiredArtifacts: ['Accessibility'], | ||||||||||
}; | ||||||||||
} | ||||||||||
} | ||||||||||
|
||||||||||
export default HTMLXMLLangMismatch; | ||||||||||
export {UIStrings}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/** | ||
* @license Copyright 2017 The Lighthouse Authors. All Rights Reserved. | ||
jazyan marked this conversation as resolved.
Show resolved
Hide resolved
|
||
* 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. | ||
*/ | ||
|
||
/** | ||
* @fileoverview Ensures input buttons have discernible text. | ||
* See base class in axe-audit.js for audit() implementation. | ||
*/ | ||
|
||
import AxeAudit from './axe-audit.js'; | ||
import * as i18n from '../../lib/i18n/i18n.js'; | ||
|
||
const UIStrings = { | ||
/** Title of an accesibility audit that evaluates if all input buttons have discernible text. This title is descriptive of the successful state and is shown to users when no user action is required. */ | ||
title: 'Input buttons have discernible text.', | ||
/** Title of an accesibility audit that evaluates if all input buttons have discernible 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: 'Input buttons do not have discernible 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. The last sentence starting with 'Learn' becomes link text to additional documentation. */ | ||
description: 'Adding discernable and accessible text to input buttons may help screen reader ' + | ||
'users understand the purpose of the input button. ' + | ||
'[Learn more about input buttons](https://dequeuniversity.com/rules/axe/4.7/input-button-name).', | ||
}; | ||
|
||
const str_ = i18n.createIcuMessageFn(import.meta.url, UIStrings); | ||
|
||
class InputButtonName extends AxeAudit { | ||
/** | ||
* @return {LH.Audit.Meta} | ||
*/ | ||
static get meta() { | ||
return { | ||
id: 'input-button-name', | ||
title: str_(UIStrings.title), | ||
failureTitle: str_(UIStrings.failureTitle), | ||
description: str_(UIStrings.description), | ||
requiredArtifacts: ['Accessibility'], | ||
}; | ||
} | ||
} | ||
|
||
export default InputButtonName; | ||
export {UIStrings}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/** | ||
* @license Copyright 2023 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. | ||
*/ | ||
|
||
/** | ||
* @fileoverview Ensure that tables use `<caption>` instead of colspan for a caption. | ||
* See base class in axe-audit.js for audit() implementation. | ||
*/ | ||
|
||
import AxeAudit from './axe-audit.js'; | ||
import * as i18n from '../../lib/i18n/i18n.js'; | ||
|
||
const UIStrings = { | ||
/** Title of an accesibility audit that evaluates if all tables use caption instead of colspan to indicate a caption. This title is descriptive of the successful state and is shown to users when no user action is required. */ | ||
title: 'Tables use `<caption>` instead of cells with the `[colspan]` attribute to indicate a ' + | ||
'caption.', | ||
/** Title of an accesibility audit that evaluates if all tables use caption instead of colspan to indicate a caption. This title is descriptive of the failing state and is shown to users when there is a failure that needs to be addressed. */ | ||
failureTitle: 'Tables do not use `<caption>` instead of cells with the `[colspan]` attribute ' + | ||
'to indicate a caption.', | ||
/** 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. The last sentence starting with 'Learn' becomes link text to additional documentation. */ | ||
description: 'Screen readers have features to make navigating tables easier. Ensuring ' + | ||
'that tables use the actual caption element instead of cells with the `[colspan]` ' + | ||
'attribute may improve the experience for screen reader users. ' + | ||
'[Learn more about captions](https://dequeuniversity.com/rules/axe/4.7/table-fake-caption).', | ||
}; | ||
|
||
const str_ = i18n.createIcuMessageFn(import.meta.url, UIStrings); | ||
|
||
class TableFakeCaption extends AxeAudit { | ||
/** | ||
* @return {LH.Audit.Meta} | ||
*/ | ||
static get meta() { | ||
return { | ||
id: 'table-fake-caption', | ||
title: str_(UIStrings.title), | ||
failureTitle: str_(UIStrings.failureTitle), | ||
description: str_(UIStrings.description), | ||
requiredArtifacts: ['Accessibility'], | ||
}; | ||
} | ||
} | ||
|
||
export default TableFakeCaption; | ||
export {UIStrings}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
In order to test this, we would need to add
lang
andxml:lang
attributes to the<html>
tag? And that would force the existinghtml-has-lang
audit to pass?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.
Yep! I figured that this is still useful because I wasn't sure if
html-xml-lang-mismatch
also checked for the existence + validity of thelang
attribute -- as in, whether this washtml-has-lang
+ checkingxml:lang
, which the docs seemed to imply. But given that this isnotApplicable
, seems like that's not the case, and this solely focuses onxml:lang
.