# theKashey/react-focus-lock

It is a trap! A lock for a Focus. 🔓

Repository: https://github.com/theKashey/react-focus-lock
Canonical: https://ross.abutalabs.com/products/react-focus-lock
Language: JavaScript
License: MIT
License Family: permissive
Topics: react, a11y, focus, modal-dialogs, focus-lock
Last push: 2026-08-10T11:39:31+00:00

## Health v2 (maintenance only)
Score: 66/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 97, release rhythm 8, longevity 100
- inputs: {"age_days": 3291, "days_push": 23, "days_rel": null, "gap_med": null, "n_releases_24m": 0}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1389, forks 74 (observed 2026-08-28T04:04:35.468173+00:00)

## What it is
A React library that traps keyboard focus within a component, such as a modal dialog, preventing users from tabbing out. It supports React portals, focus groups, return-focus behavior, and programmatic focus management.

## Use cases
- trap focus inside a modal dialog
- prevent tabbing out of a form
- manage focus for accessibility in React apps
- return focus to the trigger element when a dialog closes
- create multiple isolated focus lock groups
- handle focus for content rendered in React portals

## When to choose
- building accessible modal dialogs or popovers in React
- you need focus containment that works with portals and positive tab indexes
- you want a small, battle-tested library trusted by major UI frameworks

## When to avoid
- you need combined scroll and focus locking (consider react-focus-on)
- your project is not React-based
- you only need simple focus styling rather than focus containment

## Facets
- artifact type: library
- maturity: stable
- function: ui-components, accessibility
- domain: web-development, frontend, accessibility
- platform: browser
- tags: focus-trap, modal-dialogs, a11y, react-component, focus-management, react, javascript

## Member repositories
- theKashey/react-focus-lock (main) score 66

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:04:35.468173+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T04:39:43.863627+00:00, confidence not recorded.
  - readme: https://github.com/theKashey/react-focus-lock (fetched 2026-08-28T04:04:35.468173+00:00, sha c01d8d19a4b7)
  - registry_npm: https://registry.npmjs.org/react-focus-lock (fetched 2026-08-29T11:55:12.025182+00:00, sha 509eafeaa788)
- Data as of 2026-08-30T08:39:29.467469+00:00.
