react-modal
react-modal copied to clipboard
Added close modal on right click
Fixes #837 .
Changes proposed:
- Added feature to close modal on right click on overlay
- Use props shouldCloseOnOverlayRightClick={true} to enable this feature
- By default it is false
-Its functionality is same as prop shouldCloseOnOverlayClick
<Modal shouldCloseOnOverlayRightClick={true}>
Acceptance Checklist:
- [ ] The commit message follows the guidelines in
CONTRIBUTING.md. - [ ] Documentation (README.md) and examples have been updated as needed.
- [ ] If this is a code change, a spec testing the functionality has been added.
- [ ] If the commit message has [changed] or [removed], there is an upgrade path above.
@ZainGulbaz Looks good, but I don't think this is the right way to go...
Using a flag is nice, but later on someone will want to bind the context menu and we are going to have a flag and a callback to deal with.
In this case, it'll be better to let the user handle the event and decide want it's going to happen...
<Modal ... onOverlayContextMenu={closeModal} />
@diasbruno Ok, I will go with this approach.
@diasbruno I think this PR can be closed out given that we now have https://github.com/reactjs/react-modal/pull/963, which implements onOverlayRightClick per your suggestion (but isn't quite merge-ready).