0.4.0 • Published 6 months ago

accessibility-utils v0.4.0

Weekly downloads
-
License
MIT
Repository
-
Last release
6 months ago

Accessibility Utils

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.

Features

  • 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.

Upcoming features

  • Accessible name utility options.
  • Accessible descriptions computing.
  • Additional utilities for ARIA roles and semantic checks.

Installation

Add the library to your project using a package manager like npm or yarn:

npm install accessibility-utils

API

getAccessibleName(element, options)

Description

Computes the accessible name of an HTML element, strictly following W3C guidelines to ensure accurate results.

Parameters

  • element : HTML element for which to compute the accessible name.
  • options (optional) :
    • ignoreHiddenElements (boolean): Allows accessible name compute of hidden elements.

Returns

The accessible name of the element based on W3C guidelines. If the accessible cannot be determined, an empty string is returned.

Sources

resolveElementRole(element)

Description

Identifies the applicable ARIA role for a given element based on its attributes, structure, and semantics.

Returns

The first matched ARIA role, or undefined if no role matches the given element

Contribution

Contributions are welcome! If you'd like to improve the library, add new features, or fix issues, please follow these steps:

  1. Fork the repository.
  2. Create a branch for your feature or bug fix.
  3. Submit a pull request with a detailed description of your changes.

For any suggestions, feedback, or questions, feel free to open an issue.

License

This project is licensed under the MIT License. See the LICENSE file for more details.

0.4.0

6 months ago

0.3.0

7 months ago

0.3.2

7 months ago

0.3.1

7 months ago

0.3.4

7 months ago

0.3.3

7 months ago

1.0.0

2 years ago