npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

react-access-helper

v1.0.2

Published

![npm]([https://img.shields.io/npm/v/react-access-helper]) A lightweight library for improving accessibility in React applications. This package includes tools and hooks to simplify focus management, detect accessibility issues, and dynamically apply AR

Readme

Accessibility Helpers

npm
A lightweight library for improving accessibility in React applications. This package includes tools and hooks to simplify focus management, detect accessibility issues, and dynamically apply ARIA attributes.


Features

  • Focus Management:

    • useAccessibleFocus: Automatically sets focus on an element when a condition is met.
  • Accessibility Issue Detection:

    • checkAccessibility: Scans the DOM for accessibility violations using axe-core.
  • Dynamic ARIA Attributes:

    • addAriaAttributes: Dynamically adds ARIA attributes to elements for better screen reader support.

Installation

Install the package via npm:

npm install react-access-helper

Or with Yarn:

yarn add react-access-helper

Usage

1. Focus Management with useAccessibleFocus

Automatically manage focus for elements to enhance keyboard navigation.

import React, { useRef } from "react";
import { useAccessibleFocus } from "react-access-helper";

const App = () => {
  const ref = useRef<HTMLButtonElement>(null);

  // Focus the button when the condition is true
  useAccessibleFocus(ref, true);

  return <button ref={ref}>Click Me</button>;
};

export default App;

2. Detect Accessibility Issues with checkAccessibility

Identify and debug accessibility issues during development.

import React, { useEffect } from "react";
import { checkAccessibility } from "react-access-helper";

const App = () => {
  useEffect(() => {
    const rootElement = document.getElementById("root");
    if (rootElement) {
      checkAccessibility(rootElement).then((results) => {
        console.log("Accessibility Issues:", results.violations);
      });
    }
  }, []);

  return <div id="root">Hello, World!</div>;
};

export default App;

3. Add Dynamic ARIA Attributes

Simplify adding ARIA attributes programmatically.

import { addAriaAttributes } from "react-access-helper";

const element = document.getElementById("example");
if (element) {
  addAriaAttributes(element, {
    label: "Accessible Element",
    describedby: "description",
  });
}

API Reference

useAccessibleFocus

  • Description: A React hook to manage focus on an element when a condition is met.
  • Arguments:
    • ref: A React.RefObject of the target element.
    • condition: A boolean value indicating whether the element should receive focus.

checkAccessibility

  • Description: Detects accessibility violations in the DOM using axe-core.
  • Arguments:
    • rootElement: The root DOM node to scan for issues.
  • Returns: A Promise resolving to axe.AxeResults.

addAriaAttributes

  • Description: Adds ARIA attributes to an element dynamically.
  • Arguments:
    • element: The target DOM element.
    • attributes: A key-value pair of ARIA attributes to apply.

Why Use This Package?

  1. Simplifies Accessibility Efforts:

    • Provides easy-to-use tools for common accessibility tasks.
  2. Improves User Experience:

    • Ensures compliance with accessibility standards like WCAG.
  3. Boosts Development Efficiency:

    • Reduces repetitive code for managing ARIA attributes and focus states.
  4. Seamless Integration:

    • Works out-of-the-box with any React application.

Contributing

We welcome contributions! To contribute:

  1. Fork the repository.
  2. Create a new branch for your feature/bug fix.
  3. Submit a pull request with a detailed explanation.

License

This package is licensed under the MIT License.


Contact

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


Let me know if you’d like help with customization or further refinement!