Skip to content

[FEATURE] For components like Modal, Bottomsheet, make focus stay inside the element #222

Description

@MihirSachdeva

Feature Title

For components like Modal, Bottomsheet, make focus stay inside the element

Feature Description

When a Modal (or BottomSheet) is open, keyboard navigation using the Tab (and Shift + Tab) keys must be “trapped” inside that overlay. In other words, focus should cycle through only the interactive elements within the open modal/bottom sheet, and never jump to elements behind or outside of it.

Reproduction Steps:

This behavior matches what Material-UI’s component provides: once open, Tab navigation is constrained to the dialog’s internal elements (e.g. buttons, inputs), and never escapes to the page beneath https://mui.com/material-ui/react-dialog

Use Case

Why This Matters

Accessibility: Keyboard-only users and assistive technologies rely on predictable focus order. Without focus trapping, users can become “lost” navigating behind the modal, making the UI unusable.

Usability: Trapping focus keeps users oriented within the current context, preventing accidental interaction with background elements.

Standards Compliance: Conforming to WAI-ARIA Authoring Practices for dialogs ensures consistency across components and aligns with widely adopted patterns.

Alternatives Considered

No response

Additional Context

https://zachpatrick.com/blog/how-to-trap-focus-inside-modal-to-make-it-ada-compliant

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions