Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion lib/commons/aria/get-owned-virtual.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,12 @@ function getOwnedVirtual(virtualNode) {
// TODO: Descend into children with role=presentation|none
// TODO: Exclude descendents owned by other elements
if (virtualNode.hasAttr('aria-owns')) {
// [a11y-critical]: getNodeFromTree returns undefined for a ref outside the
// current tree, so the resolved nodes need filtering too, not just the refs
const owns = idrefs(actualNode, 'aria-owns')
.filter(element => !!element)
.map(element => axe.utils.getNodeFromTree(element));
.map(element => axe.utils.getNodeFromTree(element))
.filter(vNode => !!vNode);

// Deduplicates by first occurrence to match browser accessibility tree behavior
// See: https://github.com/dequelabs/axe-core/pull/4987
Expand Down
4 changes: 3 additions & 1 deletion lib/commons/dom/create-grid.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ export default function createGrid(
if (!parentVNode) {
let vNode = getNodeFromTree(document.documentElement);
if (!vNode) {
vNode = new VirtualNode(document.documentElement);
// [a11y-critical]: null marks the top of the tree; undefined means
// "disconnected" and makes any closest() walk through this node throw
vNode = new VirtualNode(document.documentElement, null);
}

nodeIndex = 0;
Expand Down
4 changes: 3 additions & 1 deletion lib/core/utils/dq-element.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ export function truncateElement(element) {

let vNode = getNodeFromTree(element);
if (!vNode) {
vNode = new VirtualNode(element);
// [a11y-critical]: null marks the top of the tree; undefined means
// "disconnected" and makes any closest() walk through this node throw
vNode = new VirtualNode(element, null);
}
const { nodeName } = vNode.props;

Expand Down
Loading