effex-monorepo
    Preparing search index...

    Variable FocusTrapConst

    FocusTrap: { make: (options: FocusTrapOptions) => Effect<void, never, Scope> } = ...

    Create a focus trap that keeps focus within a container element.

    The focus trap:

    • Focuses the first focusable element (or initialFocus) when activated
    • Cycles focus with Tab/Shift+Tab at boundaries
    • Restores focus to the previously focused element when deactivated
    • Automatically cleans up when the scope closes

    Type Declaration

    // In a dialog component
    const element = yield* contentRef.get;
    yield* FocusTrap.make({
    container: element,
    returnFocus: triggerElement,
    });
    // Focus is now trapped within the dialog
    // When scope closes, focus returns to triggerElement