Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@solid-aria/focus

Package Overview
Dependencies
Maintainers
2
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@solid-aria/focus - npm Package Compare versions

Comparing version 0.0.4 to 0.0.5

dist/cjs/index.js

30

package.json
{
"name": "@solid-aria/focus",
"version": "0.0.4",
"version": "0.0.5",
"private": false,

@@ -27,5 +27,14 @@ "description": "Primitives for dealing with focus rings and focus management.",

"type": "module",
"main": "dist/index.cjs",
"module": "dist/index.js",
"types": "dist/index.d.ts",
"exports": {
".": {
"solid": "./dist/source/index.js",
"import": "./dist/esm/index.js",
"browser": "./dist/esm/index.js",
"require": "./dist/cjs/index.js",
"node": "./dist/cjs/index.js"
}
},
"main": "dist/cjs/index.js",
"module": "dist/esm/index.js",
"types": "dist/types/index.d.ts",
"files": [

@@ -35,9 +44,10 @@ "dist"

"dependencies": {
"@solid-aria/interactions": "^0.0.4",
"@solid-aria/types": "^0.0.3",
"@solid-aria/utils": "^0.0.4"
"@solid-aria/interactions": "^0.0.5",
"@solid-aria/types": "^0.0.4",
"@solid-aria/utils": "^0.0.5"
},
"peerDependencies": {
"@solid-primitives/utils": "^1.3.0",
"solid-js": "^1.3.15"
"@solid-primitives/props": "^2.1.2",
"@solid-primitives/utils": "^2.0.1",
"solid-js": "^1.4.0"
},

@@ -54,3 +64,3 @@ "publishConfig": {

"scripts": {
"build": "tsup",
"build": "rollup -c",
"clean": "rm -rf .turbo && rm -rf node_modules && rm -rf dist",

@@ -57,0 +67,0 @@ "dev": "vite serve dev --host",

@@ -17,2 +17,3 @@ <p>

- [`createFocusRing`](#createFocusRing) - Determines whether a focus ring should be shown to indicate keyboard focus.
- [`FocusScope`](#FocusScope) - Utility component that can be used to manage focus for its descendants.

@@ -98,4 +99,38 @@ ## Installation

## `FocusScope`
A FocusScope manages focus for its descendants. It supports containing focus inside the scope, restoring focus to the previously focused element on unmount, and auto focusing children on mount. It also acts as a container for a programmatic focus management interface that can be used to move focus forward and back in response to user events.
### How to use it
A basic example of a focus scope that contains focus within it. Clicking the "Open" button mounts a FocusScope, which auto focuses the first input inside it. Once open, you can press the `Tab` key to move within the scope, but focus is contained inside. Clicking the "Close" button unmounts the focus scope, which restores focus back to the button.
For a full example of building a modal dialog, see [`createDialog`](../dialog/README.md).
```tsx
import { FocusScope } from "@solid-aria/focus";
import { createSignal, Show } from "solid-js";
function Example() {
const [isOpen, setOpen] = createSignal(false);
return (
<>
<button onClick={() => setOpen(true)}>Open</button>
<Show when={isOpen()}>
<FocusScope contain restoreFocus autoFocus>
<label for="first-input">First Input</label>
<input id="first-input" />
<label for="second-input">Second Input</label>
<input id="second-input" />
<button onClick={() => setOpen(false)}>Close</button>
</FocusScope>
</Show>
</>
);
}
```
## Changelog
All notable changes are described in the [CHANGELOG.md](./CHANGELOG.md) file.
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc