Skip to content

[Bug]: React useTrapFocus not working for SfDrawerΒ #3225

@rafabernad

Description

@rafabernad

Describe the Bug

useTrapFocus show keep the focus inside all focusable elements in Sfdrawer, but seems to be working only working for the first focusable element.

This wrong behavior can be seen in the storefront-ui demos: Drawer transition and trap focus preview, where the focus is kept in the close icon.

As a side effect, is not possible to have an input inside a drawer, as it never gets focused.

Expected behavior

Using tab, user should be able to move through all the focusable elements.

Steps to reproduce

See: Drawer transition and trap focus

SFUI version

@storefront-ui/[email protected]

Framework

Next.js

Node version

v20.3.0

Browser

Chrome

OS

MacOS

Relevant log output

No response

Able to fix / change the documentation?

  • Yes
  • No

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions