Skip to content

[popover] Tab loops between focus guards while a closed popup plays its exit animation #6253

Open

Description

@dimitriknight

Version: 1.6.0. In 1.9.0, useTriggerFocusGuards is rewritten, but handlePreFocusGuardFocus still always moves focus backward.

While a closed popup stays mounted for its exit animation, the trigger focus guards stay active. In 1.6.0, handleFocusTargetFocus sends focus into the inert popup, and the popup guards send it back. Focus order during one Tab: post-trigger guard, popup guard, popup guard, post-trigger guard, then the start again. A keyboard user cannot leave.

Also, handlePreFocusGuardFocus always moves focus backward. So Tab from the element before the trigger returns focus to that same element.

Steps:

  1. Give a Popover a long exit transition, for example 1 s.
  2. Open it from its trigger, then close it.
  3. During the exit, press Tab from the trigger, and press Tab from the element before the trigger.

Expected: focus moves to the next tabbable element in the direction of travel, and skips the closed popup.

Actual: focus loops, or returns to where it started.

We fixed it locally: while the popup is closed, both guards move focus to the next or previous tabbable element in the direction of travel. The open-state code does not change.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions