Skip to content

FocusTrap only focuses the first element on mount — it does not actually trap focus #9

Description

@abayomicornelius

src/components/common/FocusTrap.tsx queries focusable descendants and calls .focus() on the first one when active becomes true, but it has no keydown handler to cycle Tab/Shift+Tab within the container or prevent focus from escaping to the rest of the page.

Since this component is presumably used for modals (Modal.tsx, ConfirmModal.tsx), keyboard users can currently Tab out of an open modal into background content. Implement full cyclic focus trapping (or adopt a small tested library) and add a test.

Metadata

Metadata

Assignees

No one assigned

    Labels

    accessibilityAccessibility (a11y)bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions