react-modal icon indicating copy to clipboard operation
react-modal copied to clipboard

Added close modal on right click

Open ZainGulbaz opened this issue 3 years ago • 2 comments

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 avatar Aug 21 '22 05:08 ZainGulbaz

@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 avatar Aug 22 '22 14:08 diasbruno

@diasbruno Ok, I will go with this approach.

ZainGulbaz avatar Aug 22 '22 14:08 ZainGulbaz

@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).

doeg avatar Feb 10 '24 15:02 doeg