
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
accessible-menu
Advanced tools
A JavaScript library to help you generate WCAG accessible menus in the DOM.
A JavaScript library to help you generate WCAG accessible menus in the DOM.
The supported menu types are:
Chrome | Firefox | ![]() Safari | Edge | Chromium | Webkit |
---|---|---|---|---|---|
last 2 versions | last 2 versions | last 2 versions | last 2 versions | last 2 versions | last 2 versions |
Found something that doesn't work the way it should in one of the listed browsers above? Open an issue!
NPM is recommended for large-scale development, since it works well with bundlers like Webpack or Rollup.
# latest stable
npm install accessible-menu
For learning/prototyping purposes you can use the latest version with:
<script src="https://cdn.jsdelivr.net/npm/accessible-menu/dist/accessible-menu.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/accessible-menu@3.0.2/dist/accessible-menu.min.js"></script>
Check out the upgrade guide!
To use accessible-menu, you first need to make sure your menu matches the following structure:
<ul id="example-menu">
<li><a href="/about">About</a></li>
<li class="dropdown">
<a href="#">Projects ▼</a>
<ul>
<li><a href="/projects/awesome">Awesome project</a></li>
<li><a href="/projects/not-so-awesome">Not-so-awesome project</a></li>
</ul>
</li>
<li><a href="/contact">Contact me</a></li>
</ul>
Include accessible-menu through import or bundled library in your project:
import AccessibleMenu from "accessible-menu";
or
<script src="https://cdn.jsdelivr.net/npm/accessible-menu@3.0.0/dist/accessible-menu.min.js"></script>
Once you have accessible-menu loaded, declare a new menu object.
menuElement
is required for all menus, while submenuItemSelector
is only required if you have submenus/dropdowns.
const menu = new AccessibleMenu.DisclosureMenu({
menuElement: document.querySelector("#example-menu"),
submenuItemSelector: "li.dropdown",
});
Bundled versions of each menu are provided in the dist and individual exports are provided in the index.
There are also compiled ES Module versions if you don't want to use an iife!
import { DisclosureMenu } from "accessible-menu";
or
<script src="https://cdn.jsdelivr.net/npm/accessible-menu@3.0.0/dist/disclosure-menu.min.js"></script>
then
const menu = new DisclosureMenu({
menuElement: document.querySelector("#example-menu"),
submenuItemSelector: "li.dropdown",
});
import { Menubar } from "accessible-menu";
or
<script src="https://cdn.jsdelivr.net/npm/accessible-menu@3.0.0/dist/menubar.min.js"></script>
then
const menu = new Menubar({
menuElement: document.querySelector("#example-menu"),
submenuItemSelector: "li.dropdown",
});
import { Treeview } from "accessible-menu";
or
<script src="https://cdn.jsdelivr.net/npm/accessible-menu@3.0.0/dist/treeview.min.js"></script>
then
const menu = new Treeview({
menuElement: document.querySelector("#example-menu"),
submenuItemSelector: "li.dropdown",
});
Looking for a working example of accessible-menu? Check out these jsfiddles:
Looking to use this with Bootstrap? Because Bootstrap adds classes to the menu's containing element to show/hide the menu, you'll need custom open/close functions for your menu. Check out the accessible-menu-bootstrap-4 project where all that is done for you!
This project uses Semantic Versioning 2.0.0 to keep track of releases.
For more detailed information about SemVer, please see the official documentation.
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.
FAQs
A JavaScript library to help you generate WCAG accessible menus in the DOM.
The npm package accessible-menu receives a total of 911 weekly downloads. As such, accessible-menu popularity was classified as not popular.
We found that accessible-menu demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.