0.1.0 • Published 3 years ago

lib.dom-aria v0.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

lib.dom-aria

npm version

This project adds typings for the web's aria attributes. It also adds a polyfill for the reflection of those attributes as DOM Element properties.

It uses microsoft/vscode-custom-data (the same source of information used for VS Code's HTML and CSS autocomplete suggestions and hover documentation).

How to Use

Motivation

Most HTML attributes are reflected as object properties in the JS DOM, but reflection for some important properties is not yet implemented in some major browsers- particularly aria attributes, which at the time of this writing, have not been implemented in Firefox yet. Some front end frameworks provide this functionality, but not all projects use frameworks.

In 2018, aria attributes were specced to be reflected in DOM properties: (issue) (spec PR) (spec: editors draft) (mdn compat data).

Once that happens, I hope that either one of VS Code's Custom Data or MDN's Browser Compat Data can be integrated into TypeScript's lib.dom generator, but kind of doubt that that will happen. Seeing that the IDL definitions (which are what the TS lib generator uses) in the aria spec just specify DOMString, this package will probably still be useful after aria reflection lands in Firefox since it has documentation about what each attribute is for, and what values it can take on.

How to Build / Update

https://github.com/microsoft/vscode-custom-data#updating-web-data

cd data/
git pull
cd web-data/
yarn update-sources
yarn generate-data
cd ../..
node generate.js