-
Notifications
You must be signed in to change notification settings - Fork 779
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4022 from dequelabs/release-2023-05-15
chore(release): v4.7.1
- Loading branch information
Showing
61 changed files
with
1,169 additions
and
832 deletions.
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "axe-core", | ||
"version": "4.7.0", | ||
"version": "4.7.1", | ||
"deprecated": true, | ||
"contributors": [ | ||
{ | ||
|
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,20 @@ | ||
import getRole from '../../commons/aria/get-role'; | ||
import ariaConditionalCheckboxAttr from './aria-conditional-checkbox-attr-evaluate'; | ||
import ariaConditionalRowAttr from './aria-conditional-row-attr-evaluate'; | ||
|
||
const conditionalRoleMap = { | ||
row: ariaConditionalRowAttr, | ||
checkbox: ariaConditionalCheckboxAttr | ||
}; | ||
|
||
export default function ariaConditionalAttrEvaluate( | ||
node, | ||
options, | ||
virtualNode | ||
) { | ||
const role = getRole(virtualNode); | ||
if (!conditionalRoleMap[role]) { | ||
return true; | ||
} | ||
return conditionalRoleMap[role].call(this, node, options, virtualNode); | ||
} |
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,23 @@ | ||
{ | ||
"id": "aria-conditional-attr", | ||
"evaluate": "aria-conditional-attr-evaluate", | ||
"options": { | ||
"invalidTableRowAttrs": [ | ||
"aria-posinset", | ||
"aria-setsize", | ||
"aria-expanded", | ||
"aria-level" | ||
] | ||
}, | ||
"metadata": { | ||
"impact": "serious", | ||
"messages": { | ||
"pass": "ARIA attribute is allowed", | ||
"fail": { | ||
"checkbox": "Remove aria-checked, or set it to \"${data.checkState}\" to match the real checkbox state", | ||
"rowSingular": "This attribute is supported with treegrid rows, but not ${data.ownerRole}: ${data.invalidAttrs}", | ||
"rowPlural": "These attributes are supported with treegrid rows, but not ${data.ownerRole}: ${data.invalidAttrs}" | ||
} | ||
} | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
lib/checks/aria/aria-conditional-checkbox-attr-evaluate.js
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,39 @@ | ||
export default function ariaConditionalCheckboxAttr( | ||
node, | ||
options, | ||
virtualNode | ||
) { | ||
const { nodeName, type } = virtualNode.props; | ||
const ariaChecked = normalizeAriaChecked(virtualNode.attr('aria-checked')); | ||
if (nodeName !== 'input' || type !== 'checkbox' || !ariaChecked) { | ||
return true; | ||
} | ||
|
||
const checkState = getCheckState(virtualNode); | ||
if (ariaChecked === checkState) { | ||
return true; | ||
} | ||
this.data({ | ||
messageKey: 'checkbox', | ||
checkState | ||
}); | ||
return false; | ||
} | ||
|
||
function getCheckState(vNode) { | ||
if (vNode.props.indeterminate) { | ||
return 'mixed'; | ||
} | ||
return vNode.props.checked ? 'true' : 'false'; | ||
} | ||
|
||
function normalizeAriaChecked(ariaCheckedVal) { | ||
if (!ariaCheckedVal) { | ||
return ''; | ||
} | ||
ariaCheckedVal = ariaCheckedVal.toLowerCase(); | ||
if (['mixed', 'true'].includes(ariaCheckedVal)) { | ||
return ariaCheckedVal; | ||
} | ||
return 'false'; | ||
} |
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,36 @@ | ||
import getRole from '../../commons/aria/get-role'; | ||
import { closest } from '../../core/utils'; | ||
|
||
export default function ariaConditionalRowAttr( | ||
node, | ||
{ invalidTableRowAttrs } = {}, | ||
virtualNode | ||
) { | ||
const invalidAttrs = | ||
invalidTableRowAttrs?.filter?.(invalidAttr => { | ||
return virtualNode.hasAttr(invalidAttr); | ||
}) ?? []; | ||
if (invalidAttrs.length === 0) { | ||
return true; | ||
} | ||
|
||
const owner = getRowOwner(virtualNode); | ||
const ownerRole = owner && getRole(owner); | ||
if (!ownerRole || ownerRole === 'treegrid') { | ||
return true; | ||
} | ||
|
||
const messageKey = `row${invalidAttrs.length > 1 ? 'Plural' : 'Singular'}`; | ||
this.data({ messageKey, invalidAttrs, ownerRole }); | ||
return false; | ||
} | ||
|
||
function getRowOwner(virtualNode) { | ||
// check if the parent exists otherwise a TypeError will occur (virtual-nodes specifically) | ||
if (!virtualNode.parent) { | ||
return; | ||
} | ||
const rowOwnerQuery = | ||
'table:not([role]), [role~="treegrid"], [role~="table"], [role~="grid"]'; | ||
return closest(virtualNode, rowOwnerQuery); | ||
} |
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.