-
-
Notifications
You must be signed in to change notification settings - Fork 488
Description
- I have searched the Issues to see if this bug has already been reported
- I have tested the latest version
Steps to reproduce
Make modal according to the official docs on Modal
Current behavior
There is no close button, even though onClose is specified.
Expected behavior
The close button should either work the way it says in the docs, or the docs should be updated!
Context
Behavior was changed in #1641 to never render the close button unless dismissible is set to true. This was clearly a breaking API change that was released in 0.12.14 (a PATCH release) with only this in the changelog:
Ensure modal close button respects dismissible prop
I accepted this insidious patch release, and all my damned close buttons disappeared, trapping my users in modals.
The PR description states this:
Fixes the modal close button to only render when the modal is dismissible. Previously, the X button in the modal header would always display, even when dismissible={false}, which created a confusing UX where the button appeared but had no effect.
Which is clearly not true, clicking on the close button would indeed call the onClose handler which I was using to (😱) close modals!
I'm salty.
I'll also note that the dismissible property is described in the docs thusly:
To enable the modal to be dismissed when clicking outside of the component (ie. the backdrop) then you can pass the dismissible prop to the component from React.
That's it. Seems unrelated? My expectation, based on my reading of the docs, would be that the onClose prop is called when the user clicks the close button. And if one were to pass dismissible=[true} then clicking on the backdrop would also cause onClose to be invoked. That's it.