R
fn

focusGuard

v0.0.3tested

Adds a pair of focus guards at the boundaries of the DOM tree to ensure consistent focus behavior

Examples

ts
const guard = focusGuard();
guard.createGuard();
guard.removeGuard();
ts
const guard = focusGuard('focus-guard');
guard.createGuard();
guard.removeGuard();

Signature

ts
export function focusGuard(namespace = 'focus-guard'){ ... }

Parameters

ParameterTypeDescription
namespace?stringThe namespace to use for the guard attributes

Returns

{ selector: string; createGuard: () => void; removeGuard: () => void; }- An object containing the selector, createGuard, and removeGuard functions