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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@digitaldeployment/accessible-menu

v2.1.0

Published

A JavaScript library to help you generate WCAG accessible menus in the DOM.

Downloads

10

Readme

accessible-menu

Latest release License

A JavaScript library to help you generate WCAG accessible menus in the DOM.

The two supported menu types are:

Browser Support

| IE / Edge | Firefox | Chrome | Safari | iOS Safari | Opera | | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | IE11, Edge * | last 2 versions | last 2 versions | last 2 versions | last 2 versions | last 2 versions |

Installation

NPM

NPM is recommended for large-scale development, since it works well with bundlers like Webpack or Rollup.

# latest stable
npm install accessible-menu

CDN

For learning/prototyping purposes you can use the latest version with:

<script src="https://cdn.jsdelivr.net/npm/accessible-menu/dist/accessibleMenu.js"></script>

For production environments, it is recommend to use a specific version to avoid unforseen breaking changes:

<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/accessibleMenu.js"></script>

Usage

To use accessible-menu, you first need to ensure your menu follows a basic menu structure.

<ul>
  <li><a>...</a></li>
  <li class="dropdown">
    <button>☰</button>
    <ul>
      <li><a>...</a></li>
      ...
    </ul>
  </li>
  <li><a>...</a></li>
  ...
</ul>

include the root menu or bundled library in your project:

import AccessibleMenu from "accessible-menu";

or

<script src="path/to/accessible-menu/dist/accessibleMenu.js"></script>

Once you have accessible-menu loaded, simply declare a new menu object.

const menu = new AccessibleMenu.DisclosureMenu({
  menuElement: menuDOMObject,
  menuItemSelector: "li-css-selector",
  menuLinkSelector: "li-css-selector",
  submenuItemSelector: "li-with-dropdown-css-selector",
  submenuToggleSelector: "dropdown-toggle-css-selector",
  submenuSelector: "dropdown-menu-css-selector",
  openClass: "class-to-open-menus",
});

Documentation

Examples

Looking for a working example of accessible-menu? Check out these jsfiddles:

Internet Explorer and Edge Support

For both IE and older (non-chromium-based) versions of Edge support, you will either need to use the CDN option, or run your code through Babel.

If you are compiling your own code without the help of something like Babel + core-js, you will need polyfills for Array.from(), Array.prototype.includes(), Array.find(), and String.prototype.startsWith() for IE11 support.

Versioning

This project uses Semantic Versioning 2.0.0 to keep track of releases.

For more detailed information about SemVer, please see the official documentation.

Contributing

If you're interested in contributing to the project, please read the Contribution Guidelines. Any and all contributions must follow these guidelines or they will not be accepted.