dequelabs / dequelabs/axe-core

Update code to use new cache of idRefs to improve performance

Open
#2,647 0 comments 1 reaction 0 assignees View on GitHub
performance
Dominant language
JavaScript
Stars
7.5k
Forks
933
Avg merge
2d 23h
Merged PRs (30d)
17

Description

From @WilcoFiers in regards to #2635:

I think there are a lot more places in axe-core that now we have a cache of ID references we could speed up. Probably best to open a tech debt issue for that one instead of pile it onto this PR. Here's a list though:

- checks
- aria-required-parent-evaluate
- explicit-evaluate
- hidden-explicit-label-evaluate
- multiple-labels
- duplicate-id-evaluate
- matches
- duplicate-id-active-matches
- duplicate-id-misc-matches
- scrollable-region-focusable-matches
- commons
- text.labelVirtual
- dom.findElmsInContext
- dom.isVisible (usemap lookup)

To make that easier, we can probably simplify by having something like a `idrefsReverse` function, that takes a node (with an ID) and an attribute and looks up any element references the ID with that attribute. I'll leave it up to you if you want to do that in this PR or another.

```js
const virtualControls = idrefsReverse(ancestorNode, 'aria-labelledby')
.map(control => getNodeFromTree(control));
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.