
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
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 current reference used is W3C's Navigation Menubar Example.
![]() 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 |
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/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/accessible-menu@1.1.0/dist/accessibleMenu.js"></script>
To use accessible-menu, you first need to ensure your menu follows a basic menu structure.
<menu>
<menu-item><a>...</a></menu-item>
<menu-item-with-dropdown>
<dropdown-toggle />
<dropdown-menu>
<menu-item><a>...</a></menu-item>
...
</dropdown-menu>
</menu-item-with-dropdown>
<menu-item><a>...</a></menu-item>
...
</menu>
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({
menuElement: menuDOMObject,
menuItemSelector: "menu-item-css-selector",
submenuItemSelector: "menu-item-with-dropdown-css-selector",
submenuToggleSelector: "dropdown-toggle-css-selector",
submenuSelector: "dropdown-menu-css-selector",
openClass: "class-to-open-menus"
});
Looking for a working example of accessible-menu? Check out this jsfiddle.
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.includes()
, and Array.find()
for IE11 support.
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 954 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
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.