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

onBlur validation causes focus to go to modal root when form is in a modal #783

Open
robertcoopercode opened this issue Sep 20, 2024 · 0 comments

Comments

@robertcoopercode
Copy link

robertcoopercode commented Sep 20, 2024

Describe the bug and the expected behavior

When I blur out of an input on my form, the focus goes to the modal root and not the next focusable element on the page. Only happens for forms in a modal. Using radix modal with remix.

Note, I just found this discussion that talks about the same issue.

Conform version

v1.2.2

Steps to Reproduce the Bug or Issue

https://codesandbox.io/p/github/robertcoopercode/conform-dialog-bug/main

What browsers are you seeing the problem on?

Chrome

Screenshots or Videos

CleanShot.2024-09-20.at.12.53.08.mp4

Additional context

I've nailed down the line of code within conform that is causing the issue:

form?.removeChild(submitter);

If I comment that out, then the focus works as expected. So there must be something going on when removing the hidden submit button from the DOM (when within a modal) that causes the focus to go to the dialog itself.

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

No branches or pull requests

1 participant