Security News
ESLint is Now Language-Agnostic: Linting JSON, Markdown, and Beyond
ESLint has added JSON and Markdown linting support with new officially-supported plugins, expanding its versatility beyond JavaScript.
@stormid/modal
Advanced tools
Accessible modal dialog
Create a modal dialog and button(s) to toggle in HTML
<button class="js-modal-toggle">Open modal</button>
<div id="modal-1" class="js-modal modal" data-modal-toggle="js-modal-toggle">
<div class="modal__inner" role="dialog" aria-modal="true" aria-labelledby="modal-label">
<h2 id="modal-label">Modal title</h2>
...
<button class="modal__close-btn js-modal-toggle" aria-label="close">
<svg focusable="false" fill="#fff" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg">
<path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"/>
<path d="M0 0h24v24H0z" fill="none"/>
</svg>
</button>
</div>
</div>
Install the package
npm i -S @stormid/modal
Inititialise the module
import modal from '@stormid/modal';
const [ instance ] = modal('.js-modal');
{
onClassName: 'is--active', //className added to node when modal is open
toggleSelectorAttribute: 'data-modal-toggle', //attribute on node to use as toggle selector
callback: false, //optional function called after modal state change
delay: 0 //ms delay before focus on first focuable element
}
modal() returns an array of instances. Each instance exposes the interface
{
getState, a Function that returns the current state Object
}
npm t
MIT
FAQs
Accessible modal dialog
The npm package @stormid/modal receives a total of 117 weekly downloads. As such, @stormid/modal popularity was classified as not popular.
We found that @stormid/modal 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
ESLint has added JSON and Markdown linting support with new officially-supported plugins, expanding its versatility beyond JavaScript.
Security News
Members Hub is conducting large-scale campaigns to artificially boost Discord server metrics, undermining community trust and platform integrity.
Security News
NIST has failed to meet its self-imposed deadline of clearing the NVD's backlog by the end of the fiscal year. Meanwhile, CVE's awaiting analysis have increased by 33% since June.