Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Close modal when clicked on overlay or 'Escape' button is pressed #202

Merged
merged 1 commit into from
May 19, 2022

Conversation

Shriom-Trivedi
Copy link
Contributor

@Shriom-Trivedi Shriom-Trivedi commented May 19, 2022

Description

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.
Issue[feature request]: The filter modal should be closed when Esc button is pressed or when the modal container is clicked.

Fixes #195

Type of change

solution: Added onClose method on modal-overlay which sets useState showModal's value to false. For binding escape button, I've added a event listner in useEffect which checks whether Esc button is pressed or not and if pressed it sets showModal to false.

Please delete options that are not relevant.

  • [X ] New feature (non-breaking change which adds functionality)

How Has This Been Tested?

I've done some manual testing and it's working fine.

Checklist:

  • [ X] I have performed a self-review of my own code
  • [ X] I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • [ X] My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • [ X] New and existing unit tests pass locally with my changes
  • [ X] Any dependent changes have been merged and published in downstream modules

@vercel
Copy link

vercel bot commented May 19, 2022

Someone is attempting to deploy a commit to a Personal Account owned by @atapas on Vercel.

@atapas first needs to authorize it.

@vercel
Copy link

vercel bot commented May 19, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
react-play ✅ Ready (Inspect) Visit Preview May 19, 2022 at 3:02PM (UTC)

Copy link
Member

@atapas atapas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Shriom-Trivedi Looks good to me.

@Olaleye-Blessing
Copy link

@Shriom-Trivedi looks good👍

@atapas atapas merged commit 5877220 into reactplay:main May 19, 2022
@atapas
Copy link
Member

atapas commented May 19, 2022

@all-contributors please add @Shriom-Trivedi for Code

@allcontributors
Copy link
Contributor

@atapas

I've put up a pull request to add @Shriom-Trivedi! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

✨ [Feature request]: Close modal on click or esc pressed
3 participants