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-screen-reader-support

v1.0.3

Published

Provides a simple way to implement live regions and dynamic content updates for better screen reader support in React.

Downloads

3

Readme

Screen Reader Supporter

A React hook and component to improve accessibility for screen readers by announcing live region content dynamically.

Installation

To install the package in your project, run one of the following commands:

Using npm:

npm install screen-reader-supporter

Usage Examples

Example 1: Basic Button with Screen Reader Support

This example shows how to use the useScreenReaderSupporter hook to announce messages when the user interacts with a button (hover or focus).

import React from 'react';
import { useScreenReaderSupporter } from 'screen-reader-supporter';

const ButtonWithScreenReaderSupport = () => {
    const { handleFocusOrHover, handleBlurOrLeave } = useScreenReaderSupporter();
    
    return (
        <button
            onFocus={() => handleFocusOrHover('Button is focused')}
            onMouseEnter={() => handleFocusOrHover('Button is hovered')}
            onBlur={() => handleBlurOrLeave()}
            onMouseLeave={() => handleBlurOrLeave()}
        >
            Hover or Focus me
        </button>
    );
};

Example 2: "Click to Pay" Button with Dynamic Status Announcements

This example demonstrates how to use the useScreenReaderSupporter hook to announce dynamic payment status updates during a click-to-pay process. The user will hear updates when the button is clicked, when the payment is being processed, and when the payment is complete.

import React, { useState } from 'react';
import { useScreenReaderSupporter } from 'screen-reader-supporter';

const PaymentButton = () => {
    const [isProcessing, setIsProcessing] = useState(false);
    const [isSuccessful, setIsSuccessful] = useState(false);
    const { handleFocusOrHover, handleBlurOrLeave } = useScreenReaderSupporter();
    
    const handlePayment = () => {
        setIsProcessing(true);
        handleFocusOrHover('Payment processing started. Please wait.');
        
        // Simulate payment process with a timeout
        setTimeout(() => {
            setIsProcessing(false);
            const paymentSuccess = Math.random() > 0.5; // Random success or failure
            
            if (paymentSuccess) {
                setIsSuccessful(true);
                handleFocusOrHover('Payment successful. Thank you for your purchase!');
            } else {
                setIsSuccessful(false);
                handleFocusOrHover('Payment failed. Please try again.');
            }
        }, 3000);
    };
    
    return (
        <div>
            <button
                onFocus={() => handleFocusOrHover('Click to pay, proceed with checkout')}
                onMouseEnter={() => handleFocusOrHover('Click to pay, proceed with checkout')}
                onBlur={() => handleBlurOrLeave()}
                onMouseLeave={() => handleBlurOrLeave()}
                onClick={handlePayment}
                disabled={isProcessing}
            >
                {isProcessing ? 'Processing Payment...' : 'Click to Pay'}
            </button>
            
            {/* Display additional information for screen reader */}
            <p>
                {isProcessing ? 'Please wait while we process your payment.' : ''}
                {isSuccessful ? 'Thank you for your purchase!' : ''}
                {!isSuccessful && !isProcessing ? 'Payment failed, please try again.' : ''}
            </p>
        </div>
    );
};

export default PaymentButton;