Skip to content

Focus not trapped in detached mode #588

Closed

Description

@stefanprobst

Description

when in detached mode (fullscreen or modal), focus should be trapped.

Reproduction

Steps

  1. Go to https://www.algolia.com/doc/ui-libraries/autocomplete/introduction/what-is-autocomplete/
  2. Reduce viewport width to 500px to switch to detached mode.
  3. Click on the first autocomplete.
  4. Press Tab a couple of times (or Shift+Tab)
  5. Some hidden element is focused, and modal can't be closed with Esc anymore

Expected behavior

focus should be trapped.

Environment

  • OS: [e.g. Windows / Linux / macOS / iOS / Android]
  • Browser: [e.g. Chrome, Safari] Firefox 88
  • Autocomplete version: [e.g. 1.0.0] 1.0.1

Activity

  1. francoischalifour commented on May 19, 2021

    @francoischalifour
    Contributor

    Thanks for the report—focus trap is on our list!

    We plan to implement it in a similar way as in DocSearch.

  2. changed the title [-]focus not trapped in detached mode[/-] [+]Focus not trapped in detached mode[/+] on May 21, 2021
  3. JakeSCahill commented on Aug 21, 2023

    @JakeSCahill

    Is this the same reason why my keydown/keyup events don't trigger a scroll on the list in detached mode?

    https://deploy-preview-15--redpanda-antora-site.netlify.app/current/home/

  4. minwookshin commented on Oct 2, 2026

    @minwookshin
    Contributor

    I’d like to take this on using the DocSearch-style focus trap mentioned above, with keyboard and focus-return tests. Is that still the preferred approach?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions