react-modal
react-modal copied to clipboard
[Added] Modal Close on right click at overlay
Fixes #[837].
Changes proposed:
-Added a prop of function type 'onOverlayRightClick' that calls a function when ever we right click on modal's overlay.
-The user can then change modal's state isOpen to false, if he wants to clocse the modal on right click at overlay
- <Modal className="Modal__Bootstrap modal-dialog" isOpen={this.state.modalIsOpen} onRequestClose={this.handleModalCloseRequest} **onOverlayRightClick={this.handleModalCloseRequest}** >
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.
We are going in the right direction, just made some comments. It must be the last change. Obrigado pelo PR.
Awesome!! :tada:
Can you include a test for this, please?
@diasbruno I have added latest commit of example test case. Kindly let me know, if you have any suggestions.
It looks great, but we also need to add an unit testing for this feature. Let me know if you need anything...
Is there any unit testing already done?
All unit tests are here https://github.com/reactjs/react-modal/tree/master/specs
I'm sorry to interrupt, but I think it's awkward that the library provides click events.
To ensure consistency, you should add all basic events such as onClick
, onMouseMove
before adding onOverlayRightClick
.
To implement the functionality of closing the modal when the user right-clicks, you can make use of overlayRef
.
@honeymaro It depends.
You should use overlayRef
only if you need to do something with the reference.
In this case, having 2 options is not a terrible idea.