function trapFocus
trapFocus(container: HTMLElement): void

Traps focus within a given container element. Useful for modal dialogs to prevent users from tabbing outside the modal.

Parameters

container: HTMLElement

The HTMLElement within which to trap focus.

Return Type

void

Usage

import { trapFocus } from ".";