Skip to content

4. Root

jonathandewitt-dev edited this page Jan 9, 2020 · 3 revisions

Documentation - The root property

The root property can be added to the top level of the config object passed into the main function. If it is not assigned, document.body will be treated as the root element. If you pass your own element to the root property, all rules will be scoped to that particular element. This is especially useful if you are using a component system, and you'd like to keep each component's accessibility rules independent from each other.

addAccessibilityRules({
  root: document.querySelector('.component')
})
Clone this wiki locally