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

pizzaria

v0.0.2

Published

Aria utils for better a11y

Readme

README.md for Pizzaria


🍕 Pizzaria

Pizzaria is a lightweight library for managing ARIA attributes and roles in web development. It simplifies accessibility implementation by providing helper functions to add, remove, and validate ARIA attributes across single or multiple elements.


🚀 Features

  • Batch operations: Apply ARIA attributes to multiple elements using CSS selectors.
  • Role management: Easily set or modify ARIA roles for elements.
  • Accessibility helpers: Manage modals, alerts, and other ARIA-compliant components.
  • Clean and readable API: Designed for developers who value simplicity and performance.

📦 Installation

Install Pizzaria via npm:

npm install pizzaria

Or with yarn:

yarn add pizzaria

🔧 Usage

Import the library

import {
  setAriaAttributes,
  setAriaRole,
  removeAriaAttributes,
  hasAriaAttribute,
  setAriaModal,
  setAriaAlert,
} from 'pizzaria';

🔹 Basic Examples

Set multiple ARIA attributes:

setAriaAttributes('.button', {
  pressed: 'false',
  label: 'Submit',
});

Set an ARIA role:

setAriaRole('#modal', 'dialog');

Remove specific ARIA attributes:

removeAriaAttributes('.button', ['pressed', 'label']);

Check if elements have a specific ARIA attribute:

const hasPressed = hasAriaAttribute('.button', 'pressed');
console.log(hasPressed); // true or false

Manage ARIA attributes for a modal:

setAriaModal('#modal', true); // Opens the modal
setAriaModal('#modal', false); // Closes the modal

Configure an ARIA alert:

setAriaAlert('#alert', 'This is an alert message');

🛠️ API Reference

setAriaAttributes

Set multiple ARIA attributes for one or more elements.

  • Parameters:
    • selector (string): CSS selector for the target elements.
    • attributes (object): Key-value pairs of ARIA attributes to set.
    • context (Document | HTMLElement): (Optional) Limits the scope of the selector. Defaults to document.

setAriaRole

Assign a specific ARIA role to one or more elements.

  • Parameters:
    • selector (string): CSS selector for the target elements.
    • role (string): The ARIA role to set.
    • context (Document | HTMLElement): (Optional) Limits the scope of the selector. Defaults to document.

removeAriaAttributes

Remove specific ARIA attributes from one or more elements.

  • Parameters:
    • selector (string): CSS selector for the target elements.
    • attributes (array of strings): List of ARIA attributes to remove.
    • context (Document | HTMLElement): (Optional) Limits the scope of the selector. Defaults to document.

hasAriaAttribute

Check if all elements selected by the CSS selector have a specific ARIA attribute.

  • Parameters:

    • selector (string): CSS selector for the target elements.
    • attribute (string): The ARIA attribute to check.
    • context (Document | HTMLElement): (Optional) Limits the scope of the selector. Defaults to document.
  • Returns: (boolean) true if all elements have the attribute, otherwise false.


setAriaModal

Configure ARIA attributes for modal dialogs.

  • Parameters:
    • selector (string): CSS selector for the modal element.
    • isOpen (boolean): true to open the modal, false to close it.
    • context (Document | HTMLElement): (Optional) Limits the scope of the selector. Defaults to document.

setAriaAlert

Configure ARIA attributes and content for alert elements.

  • Parameters:
    • selector (string): CSS selector for the alert element.
    • message (string): The alert message to display.
    • context (Document | HTMLElement): (Optional) Limits the scope of the selector. Defaults to document.

🧪 Testing

Run the comprehensive test suite to validate Pizzaria:

npm test

The suite covers:

  • Setting, removing, and validating ARIA attributes.
  • Managing ARIA roles for accessibility.
  • Handling edge cases with modals and alerts.
  • Batch operations on multiple elements.

📜 License

MIT


If you have ideas or want to contribute, feel free to submit a pull request or open an issue! 🍕