reactjs-popup
reactjs-popup copied to clipboard
Feature: controlled canClose
Hello,
For our usecase, we have a form contained within a popup and want to be able to control when a user can close the popup, especially on closeOnDocumentClick and closeOnEscape. This allows for more finegrained control of the popup experience.
Technically this is achievable with a controlled popup at the moment, but this required a lot of custom logic that pretty much duplicates the props closeOnDocumentClick, etc.
I can submit a PR with this feature and tests, just looking to see if this is a feature that reactjs-popup wants to support.
Thank you @dlimx for your suggestion, I think this would be the normal behavior with reacjs-popup v2 as we rewrite the component using hooks and function component instead of a class.
Will you be accepting PRs for v1? Or help for v2?
the v2 will be published by the end of the week, then we can test it to see if it ready for your use case
@yjose it seems that even in v2 popup is only semi-controllable :(
My expectations were that if onClose and close props were provided, developer is in full charge of managing the popup state, but instead for the closeOnDocumentClick / closeOnEscape the onClose is called, but even with close = false the popup closes