# @frankhoodbs/a11y-support

> Accessibility utilities

Latest version **5.0.0** (published 2026-03-04) · ISC license · 0 weekly downloads

## Install

```sh
npm install @frankhoodbs/a11y-support
pnpm add @frankhoodbs/a11y-support
yarn add @frankhoodbs/a11y-support
bun add @frankhoodbs/a11y-support
```

## Health

**Score 55/100 (C)** — status: stable.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 5.0.0 |
| Published | 2026-03-04 |
| First published | 2023-09-29 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 2 |
| Unpacked size | 6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Frankhood Business Solutions s.r.l. |
| Maintainers | giando110188, frankhood-info, skill83, m.brandonisio |

## Links

- npm: https://www.npmjs.com/package/@frankhoodbs/a11y-support
- npm.io page: https://npm.io/package/@frankhoodbs/a11y-support

## Dependencies (2)

- [focus-trap](https://npm.io/package/focus-trap.md) ^8.0.0
- [body-scroll-lock](https://npm.io/package/body-scroll-lock.md) ^3.1.5

## Recent versions

- 5.0.0 (latest) — 2026-03-04
- 4.0.2 — 2025-11-26
- 4.0.1 — 2025-11-12
- 4.0.0 — 2025-10-24
- 3.0.4 — 2025-07-17
- 3.0.3 — 2025-06-04
- 3.0.2 — 2025-05-27
- 3.0.1 — 2025-05-15
- 3.0.0 — 2025-04-24
- 2.0.3 — 2024-11-05
- 2.0.2 — 2024-10-01
- 2.0.1 — 2024-09-30
- 1.2.12 — 2024-09-25
- 1.2.11 — 2024-09-17
- 1.2.10 — 2024-07-15
- … 35 more at https://npm.io/package/@frankhoodbs/a11y-support/versions

## README

# A11y Support

A collection of JavaScript utilities designed to enhance web accessibility and improve user experience. This module leverages powerful features from the `ally.js` library, `focus-trap`, and `body-scroll-lock`.

## Features

1. **Focus management**:
    - Directly focus on a specific element.
    - Determine if a given element is the currently active one.
    - Quickly query focusable elements.
    - Trap user focus within a specific element.
    - Focus on the first element within a given context.

2. **Scroll management**:
    - Lock the body's scroll, while keeping the designated target element scrollable.
    - Unlock the body's scroll. If a target element is provided, it re-enables scrolling for that specific element. If no target is provided, it clears all body scroll locks.

3. **Utilities**:
    - Convert boolean values to their string representation ('true' or 'false').

## Usage

Here are some of the primary utilities and their descriptions:

### Focus Management

- `elementFocus(element: HTMLElement)`: Focuses the given element.

- `isActiveElement(element: HTMLElement)`: Checks if the given element is currently active.

- `createFocusTrap(element: HTMLElement)`: Creates a focus trap for the given element, which is useful for modals and other UI components where trapping user focus is essential.

- `firstElementFocus(context: string | HTMLElement)`: Focuses on the first element within the provided context.

### Scroll Management

- `lockBodyScroll(target: HTMLElement)`: Locks the body's scroll while allowing the specified target element to remain scrollable.

- `unlockBodyScroll(target?: HTMLElement)`: Unlocks the body's scroll. If a target element is provided, it re-enables scrolling for that particular element. If no target is specified, it clears all body scroll locks.

### Utilities

- `boolToString(value: boolean)`: Converts a boolean value to its string representation ('true' or 'false').

## Dependencies

- [focus-trap](https://www.npmjs.com/package/focus-trap)
- [body-scroll-lock](https://www.npmjs.com/package/body-scroll-lock)

---
_Source: https://npm.io/package/@frankhoodbs/a11y-support · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
