Skip to content

[TrapFocus] causes infinite loop when used in a Dialog #2641

@darrenhebner

Description

@darrenhebner

Issue summary

The TrapFocus component appears to be creating an infinite loop. If you look at the stacktrace below, you can see that Dialog triggers focusFirstFocusableNode which triggers a focusin event. This event triggers handleFocusIn which calls focusFirstFocusableNode. The loop keeps going.

This ends up locking the main thread for a significant time.

Screen Shot 2020-01-21 at 1 55 52 PM

Expected behavior

After the initial focus, the loop should stop.

Steps to reproduce the problem

This doesn't appear to be happening with all modals. I haven't been able to identify what scenario causes this bug.

cc @devonpmack @AndrewMusgrave

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugSomething is broken and not working as intended in the system.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions