reactjs-popup icon indicating copy to clipboard operation
reactjs-popup copied to clipboard

Feature: controlled canClose

Open dlimx opened this issue 5 years ago • 4 comments

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.

dlimx avatar Aug 06 '20 13:08 dlimx

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.

yjose avatar Aug 24 '20 15:08 yjose

Will you be accepting PRs for v1? Or help for v2?

dlimx avatar Aug 25 '20 22:08 dlimx

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 avatar Aug 26 '20 16:08 yjose

@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

wasd171 avatar Dec 30 '20 15:12 wasd171