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

@chakra-ui/focus-lock

Package Overview
Dependencies
Maintainers
3
Versions
258
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@chakra-ui/focus-lock

React focus lock for all Chakra components

  • 0.0.0-dev-20221108073543
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
202K
decreased by-57.92%
Maintainers
3
Weekly downloads
 
Created

What is @chakra-ui/focus-lock?

@chakra-ui/focus-lock is a utility package for managing focus within a specific part of the DOM. It is particularly useful for creating accessible modal dialogs, popovers, and other components that require focus to be trapped within a certain area.

What are @chakra-ui/focus-lock's main functionalities?

Focus Lock

This feature ensures that focus is trapped within the modal component, preventing users from tabbing out of the modal.

import { FocusLock } from '@chakra-ui/focus-lock';

function Modal() {
  return (
    <FocusLock>
      <div>
        <h1>Modal Title</h1>
        <p>Modal Content</p>
        <button>Close</button>
      </div>
    </FocusLock>
  );
}

Auto Focus

This feature automatically focuses the first focusable element within the FocusLock component when it is rendered.

import { FocusLock } from '@chakra-ui/focus-lock';

function Modal() {
  return (
    <FocusLock autoFocus>
      <div>
        <h1>Modal Title</h1>
        <p>Modal Content</p>
        <button>Close</button>
      </div>
    </FocusLock>
  );
}

Persistent Focus

This feature ensures that focus remains within the FocusLock component even if the user tries to click outside of it.

import { FocusLock } from '@chakra-ui/focus-lock';

function Modal() {
  return (
    <FocusLock persistentFocus>
      <div>
        <h1>Modal Title</h1>
        <p>Modal Content</p>
        <button>Close</button>
      </div>
    </FocusLock>
  );
}

Other packages similar to @chakra-ui/focus-lock

Keywords

FAQs

Package last updated on 08 Nov 2022

Did you know?

Socket

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.

Install

Related posts

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