Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Focus goes behind backdrop when Dialog closed via mouse click #33017

Open
2 tasks done
nigolaj opened this issue Oct 10, 2024 · 2 comments
Open
2 tasks done

[Bug]: Focus goes behind backdrop when Dialog closed via mouse click #33017

nigolaj opened this issue Oct 10, 2024 · 2 comments

Comments

@nigolaj
Copy link

nigolaj commented Oct 10, 2024

Component

Dialog

Package version

9.54.13

React version

18.3.1

Environment

System:
OS: Linux 6.10 Debian GNU/Linux 12 (bookworm) 12 (bookworm)
CPU: (8) x64 11th Gen Intel(R) Core(TM) i5-1145G7 @ 2.60GHz
Memory: 6.77 GB / 15.01 GB
Container: Yes
Shell: 5.2.15 - /bin/bash
npmPackages:
@fluentui/react-components: ^9.54.13 => 9.54.13
@types/react: ^18.3.3 => 18.3.4
@types/react-dom: ^18.3.0 => 18.3.0
react: ^18.3.1 => 18.3.1
react-dom: ^18.3.1 => 18.3.1

Current Behavior

Closing Dialog B opened via a Button from Dialog A causes focus to go behind Dialog A's backdrop despite useRestoreFocusTarget() being set on the Button. This renders form inputs in Dialog A unusable. The issue only manifests when Dialog B is closed with a mouse click, not Esc.

Expected Behavior

Closing Dialog B causes focus to go back to the Button in all cases.

Reproduction

https://stackblitz.com/edit/83wvqv-ndwglu?file=src%2Fexample.tsx

Steps to reproduce

Open BOTTOM dialog
Open TOP dialog
Close TOP dialog WITH A MOUSE CLICK (not keyboard)
Attempt to focus the input in BOTTOM dialog
Note how focus immediately goes behind BOTTOM dialog's backdrop

Are you reporting an Accessibility issue?

None

Suggested severity

Medium - Has workaround

Products/sites affected

No response

Are you willing to submit a PR to fix?

no

Validations

  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • The provided reproduction is a minimal reproducible example of the bug.
@TristanWatanabe
Copy link
Member

Can confirm repro of this bug, closing the second Dialog via mouse click does not restore focus to the first Dialog's trigger button (it does when hitting Esc key + adding useRestoreFocusTarget however)

@miroslavstastny
Copy link
Member

First, we need to check whether this is a bug in tabster. Also see #33230

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

No branches or pull requests

4 participants