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

@smeechos/moda11y-vanilla-js-modal

v1.2.1

Published

Simple vanilla JS modal library based on WAI-ARIA guidelines.

Readme

moda11y-vanilla-js-modal

GitHub GitHub package.json version GitHub JS file size in bytes GitHub CSS file size in btyes

Simple vanilla JS modal library based on WAI-ARIA guidelines, specifically as it relates to dialogs / modals.

Please find the demo here.

Jump To:


Installation

  1. Package can be installed via npm:
npm i @smeechos/moda11y-vanilla-js-modal
  1. Include the packages' JavaScript:
import Moda11y from "@smeechos/moda11y-vanilla-js-modal";
  1. Include base CSS:
@import "~@smeechos/moda11y-vanilla-js-modal/dist/styles/moda11y-css.min.css";
  1. Initialize the class:
let moda11y = new Moda11y();
moda11y.init();

Usage

Below is some sample markup for using the library:

Modal Trigger

<button class="moda11y-trigger"
        data-moda11y-target="moda11y-modal-1"
        aria-haspopup="dialog">
    Modal Trigger
</button>

Modal Content

<div class="moda11y-modal-content" id="moda11y-modal-1">
    <!-- Modal Markup Goes Here-->
</div>

How It Works

Once a modal trigger has been clicked, the modal will be added to the page via JavaScript.

Since there is only ever a single modal at a time, as it is being generated on the fly, you need to ensure that the moda11y-modal-content element is present, and its id matches the data-moda11y-target attribute on the button trigger. This is how the library knows what content to place into the modal once it is generated.

The modal's content will contain all the HTML from within the moda11y-modal-content.

Events

| Method | Element | Description | | ----------- | ----------- | ----------- | | moda11y-shown | moda11y-trigger | Fires once the modal is shown. | | moda11y-shown | moda11y-trigger | Fires when the modal is removed (right before focus is returned to trigger). |

Methods

| Method | Description | Use Case | | ----------- | ----------- | ----------- | | init() | Initializes the library and sets all event listeners. | This is necessary to ensure the modal triggers have the event listeners setup to trigger the modal when clicked. | | reinit() | Re-initializes the library and resets all event listeners. | AJAX is being used to manipulate the DOM, and new triggers are added to the page. Because they weren't present during original init(), we must setup event listeners for those new elements. |

Options

The following options are to be set on the modal trigger button as data attributes.

data-moda11y-classes

Adding this attribute to the modal trigger button will ensure the provided classes are added to the modal when it is created.

<button class="moda11y-trigger"
        data-moda11y-target="moda11y-modal-1"
        data-moda11y-classes="className1 className2"
        aria-haspopup="dialog">
    Modal Trigger
</button>