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

nested FocusLock #23

Closed
warreng opened this issue Feb 28, 2018 · 1 comment
Closed

nested FocusLock #23

warreng opened this issue Feb 28, 2018 · 1 comment

Comments

@warreng
Copy link

warreng commented Feb 28, 2018

@theKashey could you provide a story for a nested FocusLock? I am trying to achieve this with a dialog (modal) that opens another dialog.

When I open the first dialog the focus lock has no autofocus and is not trapped.
When I open the second dialog the focus lock works as expected.

Here is the code for the dialog component.

<FocusLock>
    <Dialog
        {...props}
    >
        {children}
    </Dialog>
</FocusLock>
@theKashey
Copy link
Owner

Maybe your Dialog portaling children. FocusLock operates on DOM tree, and any portaled parts of React tree break the stuff (#19).
Try

<Dialog {...props}>
   <FocusLock>
       {children}
   </FocusLock>
</Dialog>

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

2 participants