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

Allow to define a custom tag for the modal container? #467

Open
FezVrasta opened this issue Jul 31, 2017 · 3 comments
Open

Allow to define a custom tag for the modal container? #467

FezVrasta opened this issue Jul 31, 2017 · 3 comments

Comments

@FezVrasta
Copy link

It would be super handy to be able to define a custom tag for the modal container element. So that I can set it as:

<ReactModal tag="form">

This would make easy to manage modals used as forms.

@diasbruno
Copy link
Collaborator

diasbruno commented Jul 31, 2017

Hi @FezVrasta, yeah, it would be convenient, but maybe it's not a good idea give to react-modal this responsibility. A snippet like this (below) should be "the best" approach:

<Modal ...>
   <MyForm {...props} /> {/* -> <form ....>....</form> */}
</Modal>

This way you can use MyForm on other places.

@FezVrasta
Copy link
Author

But then you get the focus on the modal that's different from the form element 🤔 wouldn't this be a problem?

@diasbruno
Copy link
Collaborator

diasbruno commented Jul 31, 2017

@FezVrasta hmm, this is something we need to find a solution. There is onAfterOpen, you can use this callback to move the focus to your component.

Of course, ideas/suggestions are welcome.

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

2 participants