Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
svelte-a11y-dialog
Advanced tools
Experimental!
This is a Svelte wrapper component for a11y-dialog@7.3.0
npm install svelte-a11y-dialog
After installing the npm package, import the SvelteA11yDialog
component
and optionally setup a dialog instance binding:
import { SvelteA11yDialog } from "svelte-a11y-dialog";
let dialogInstance;
const assignDialogInstance = (instance) => {
dialogInstance = instance;
}
Then use as follows:
<button
type="button"
data-a11y-dialog-show="a11y-dialog"
>Open dialog</button>
<SvelteA11yDialog
id="a11y-dialog"
dialogRoot="#dialog-root"
closeButtonLabel="My close button label"
closeButtonPosition="last"
title="A11yDialog Test"
titleId="uniqueTitleId"
role="dialog"
on:instance={assignDialogInstance}
>
<svelte:fragment slot="closeButtonContent">
<span>Close</span>
</svelte:fragment>
<div>
<p>This is some content</p>
</div>
</SvelteA11yDialog>
In your main index.html
, add a container where your dialog will be rendered into — dialog-root
in this example:
<!DOCTYPE html>
<html>
<body>
<div id="app"></div>
<div id="dialog-root"></div>
</body>
</html>
The
a11y-dialog
documentation is here
id
id
String
true
id
attribute added to the dialog element, internally used by a11y-dialog to manipulate the dialog.dialogRoot
dialogRoot
String
— CSS Selector string.true
classNames
classNames
Object
false
{}
base
, overlay
, document
, title
, closeButton
. See a11y-dialog docs for reference.title
title
String
true
classes.title
to it.titleId
titleId
String
false
id + '-title'
.id
attribute of the dialog’s title element, used by assistive technologies to provide context and meaning to the dialog window.closeButtonLabel
closeButtonLabel
String
false
'Close this dialog window'
aria-label
attribute of the close button, used by assistive technologies to provide extra meaning to the usual cross-mark.role
role
String
false
dialog
role
attribute of the dialog element, either dialog
(default) or alertdialog
to make it a modal (preventing closing on click outside of ESC key).on:instance
a11y-dialog
instance when a11y-dialog is instantiated via
a Svelte dispatch
event. Note that as is idiomatic in dispatched Svelte events, you need to access the instance via event.detail
object (see below).a11y-dialog
instance once the component has been instantiated. Here's an example of how to set up in your parent component (pay special note of the ev.detail.instance
to gain access to the passed a11y-dialog instance!):<script>
const assignDialogInstance = (ev) => {
dialogInstance = ev.detail.instance;
};
const openDialog = () => {
if (dialogInstance) {
dialogInstance.show();
}
};
</script>
<SvelteA11yDialog on:instance={assignDialogInstance} ...etc
title
title
closeButtonContent
closeButtonLabel
\u00D7
(×)closeButtonPosition
closeButtonPosition
first
first
, last
, or none
This has only been tested client-side.
FAQs
Svelte component wrapping for a11y-dialog
The npm package svelte-a11y-dialog receives a total of 259 weekly downloads. As such, svelte-a11y-dialog popularity was classified as not popular.
We found that svelte-a11y-dialog 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’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.