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

How to perform action on modal open? #50

Closed
AndrewRayCode opened this issue Jun 26, 2015 · 5 comments
Closed

How to perform action on modal open? #50

AndrewRayCode opened this issue Jun 26, 2015 · 5 comments

Comments

@AndrewRayCode
Copy link
Contributor

It seems that with the isOpen api, neither componentDidMount nor componentDidUpdate actually guarantee the modal is open, even when making sure props.isOpen is set. I'm not sure what causes the delay, but if I want to do something like focus an input on modal open, I can't do it because the modal isn't visible yet.

@ghost
Copy link

ghost commented Jun 29, 2015

set it 'true'

@AndrewRayCode
Copy link
Contributor Author

@yhjor1212 what? set what to true?

@anatoliyarkhipov
Copy link

What did you mean by "delay"? From what moment it is delayed?

@thesunny
Copy link

Thanks for putting this React Modal together. Really nice.

I think this and the issue on focus can be handled by having an onAfterOpen callback passed in as a prop. This way, after the modal is open, we can perform an action on open which includes the ability to set the focus.

My feeling is that it may be beneficial to remove the auto-focus since it's not necessary in a lot of cases and in cases where you want it, you can easily add focus through the onAfterOpen callback. In any case, if you do keep it, just a reminder to make sure the autofocus happens before the onAfterOpen callback or else any focus set in the callback would be lost.

Would also solve the following issue: #51

@claydiffrient
Copy link
Contributor

Closing because #154 was released.

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

4 participants