A lightweight Typescript library providing utilities to handle web accessibility, with a focus on computing accessible names and roles of HTML elements according to W3C standards.
- Accessible name computing: Retrieve accurate, standards-based accessible names for HTML elements.
- Element role resolution: Identify ARIA roles of elements based on their semantics and attributes.
- Standards-Compliant: Follows the latest W3C guidelines and ARIA specifications.
- Accessible name utility options.
- Accessible descriptions computing.
- Additional utilities for ARIA roles and semantic checks.
Add the library to your project using a package manager like npm or yarn:
npm install accessibility-utilsComputes the accessible name of an HTML element, strictly following W3C guidelines to ensure accurate results.
element: HTML element for which to compute the accessible name.options(optional) :ignoreHiddenElements(boolean): Allows accessible name compute of hidden elements.
The accessible name of the element based on W3C guidelines. If the accessible cannot be determined, an empty string is returned.
Identifies the applicable ARIA role for a given element based on its attributes, structure, and semantics.
The first matched ARIA role, or undefined if no role matches the given element
Contributions are welcome! If you'd like to improve the library, add new features, or fix issues, please follow these steps:
- Fork the repository.
- Create a branch for your feature or bug fix.
- Submit a pull request with a detailed description of your changes.
For any suggestions, feedback, or questions, feel free to open an issue.
This project is licensed under the MIT License. See the LICENSE file for more details.