Skip to content

Focus trap doesn't work in React 18 #720

@moroshko

Description

@moroshko

I'm using focus-trap-react 9.0.1 and the focus trap doesn't seem to work.
If I focus on the first <input> and press Tab twice, I land on the second <input> that sits outside the trap.
What am I missing?

<div className="App">
  <FocusTrap>
    <div>
      <input type="text" />
      <button>Submit</button>
    </div>
  </FocusTrap>
  <input type="text" placeholder="I am outside the trap" />
</div>

Codesandbox

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions