Semantic-ui-react: Modal will autoclose with an opened Portal

Created on 18 Jan 2018  路  9Comments  路  Source: Semantic-Org/Semantic-UI-React

Steps

  1. Create a <Modal /> with an onClose prop and a <Portal />.
  2. Keep opened <Portal />.
  3. Open <Modal />.

Expected Result

Modal should open.

Actual Result

Modal never will open. Modal uses Portal as a wrapper if I understand clearly. click event listener subs to all open modals and portals and pass through all of them. Since didClicknRootNodeClick has been changed here, <Modal /> handles a click in handleDocumentClick and recognizes it as click on dimmer. Everything is ok if <Modal /> will be without dimmer or <Modal />'s content will be right under a click point.

Version

0.77.2

Testcase

https://codesandbox.io/s/9y3wzpyjky

Most helpful comment

Confirmed worked. Forked codesandbox here: https://codesandbox.io/s/328x7n20ym. I only needed to update to the latest 0.78.1 to get the fix.

Thanks for the reporting folks!

All 9 comments

Same happening here after upgrade to 0.77.2.

Yes, this sounds like it is duplicated in #2493. See workarounds there. A fix is in the works.

I am releasing 0.78.1 right now with a proposed fix for this. Once it is live (~10 minutes), please update the codesandbox, try it, and report back.

Confirmed worked. Forked codesandbox here: https://codesandbox.io/s/328x7n20ym. I only needed to update to the latest 0.78.1 to get the fix.

Thanks for the reporting folks!

@levithomason it works for me too. Thank you for your work!

@levithomason seems like the issue is reproduced when the content of modal is changed. https://codesandbox.io/s/30n2v379r1 here is the example when changing one form with another - onClose is fired, it's important that the second form has more inputs, so markup very is different. Of course, workarounds are possible, but still.

OK, opened #2888

Was this page helpful?
0 / 5 - 0 ratings