
Research
/Security News
Weaponizing Discord for Command and Control Across npm, PyPI, and RubyGems.org
Socket researchers uncover how threat actors weaponize Discord across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.
web-components-aria-modal
Advanced tools
Accessible modal with Web Components
yarn add web-components-aria-modal
or npm i web-components-aria-modal
import 'web-components-aria-modal';
/**
* do something
*/
You can append your modal inside aria-modal with slot
. If you use slot
, you can use accessible feature for modal.
Please see following example.
<aria-modal>
<div name="modal">
<!-- ... -->
</div>
</aria-modal>
Using css variables, you can apply your style to <aria-modal>
.
aria-modal {
--backdrop-display: block; /* or flex, inline-block, etc... */
--backdrop-color: rgba(0, 0, 0, 0.3); /* background-color for backdrop */
--backdrop-position: absolute; /* or fixed */
--backdrop-z-index: 0;
}
name | required | default | description |
---|---|---|---|
open | false | false | It is used to show modal. You can set true if you want to open modal. |
first-focus | true | none | It is used to focus to first element when modal is opened. You should assign id name. |
node | true | none | It is used to move focus inside modal. You should set modal id name. |
animation | false | false | Fade animation will run if animation flag is true . |
duration | false | 300 | animation duration time |
active | false | none | active is class that is added when open props is changed true . |
aria-label or aria-labelledby | true | none | See https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques/Using_the_aria-labelledby_attribute |
aria-describedby | true | none | See https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques/Using_the_aria-describedby_attribute |
role | true | none | Assignable value are dialog or alertdialog . See https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles |
aria-modal | false | true | See https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/dialog_role |
If the active class is not set to aria-modal
, it may flicker when reloaded on browser. When you set active class, you should set your modal to display: none;
and you should set your active class to display: block; /* or flex, inline-block, etc... */
.
This problem is occurred by rendering process for Web Components. Your modal is assigned to slot
element in aria-modal
, and slot
is rendered after JavaScript file(and Web Components) have loaded. That is, this problem is occurred by your modal is rendered without your modal is assigned to slot.
https://github.com/github/clipboard-copy-element/tree/master/examples
FAQs
Accessible modal with Web Components
We found that web-components-aria-modal demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.
Research
/Security News
Socket researchers uncover how threat actors weaponize Discord across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.
Security News
Socket now integrates with Bun 1.3’s Security Scanner API to block risky packages at install time and enforce your organization’s policies in local dev and CI.
Research
The Socket Threat Research Team is tracking weekly intrusions into the npm registry that follow a repeatable adversarial playbook used by North Korean state-sponsored actors.