Skip to content

fix(common): close mobile nav drawer when tapping outside overlay#1663

Merged
priyankarpal merged 1 commit intoreactplay:mainfrom
aniketmishra-0:fix/mobile-nav-drawer-close-on-outside-tap
Feb 7, 2026
Merged

fix(common): close mobile nav drawer when tapping outside overlay#1663
priyankarpal merged 1 commit intoreactplay:mainfrom
aniketmishra-0:fix/mobile-nav-drawer-close-on-outside-tap

Conversation

@aniketmishra-0
Copy link
Contributor

Description

Fixes #1659

The mobile nav drawer did not close when tapping outside the drawer panel on mobile devices.

Changes

  • Added onClick handler on the navbar-collapse overlay to close the drawer when tapping outside
  • Added e.stopPropagation() on header-links to prevent clicks inside the drawer from closing it
  • Added smooth slide (translateX) and fade (opacity) CSS transitions for open/close animation
  • Replaced display: none/block with visibility + pointer-events to enable CSS transitions
  • Added cursor: pointer on overlay for better UX affordance

Files Changed

  • src/common/header/HeaderNav.jsx - Added click handlers for overlay close behavior
  • src/common/header/header.css - Added transition animations, restructured mobile nav styles

Testing

  1. Open the app on mobile or resize browser below 1217px
  2. Tap the hamburger menu to open the nav drawer
  3. Tap the dark overlay area outside the drawer
  4. Drawer smoothly slides closed and overlay fades out
  5. Clicking inside the drawer does NOT close it
  6. The X close button still works as before

Before

  • Tapping overlay outside drawer: nothing happened
  • Opening/closing: instant show/hide, no animation

After

  • Tapping overlay outside drawer: drawer closes with smooth animation
  • Opening: drawer slides in from right, overlay fades in (0.3s ease)
  • Closing: drawer slides out to right, overlay fades out (0.3s ease)

Add onClick handler on the navbar-collapse wrapper to close the mobile
navigation drawer when users tap on the dark overlay area outside the
drawer panel. Stop event propagation on header-links to prevent clicks
inside the drawer from closing it.

Add smooth slide and fade transition animation for the drawer panel
(translateX) and overlay (opacity) so the drawer does not just abruptly
appear/disappear. Replace display:none/block toggle with visibility and
pointer-events approach to enable CSS transitions.

Fixes reactplay#1659
Copilot AI review requested due to automatic review settings February 7, 2026 07:42
@netlify
Copy link

netlify bot commented Feb 7, 2026

Deploy Preview for reactplayio ready!

Name Link
🔨 Latest commit aa17005
🔍 Latest deploy log https://app.netlify.com/projects/reactplayio/deploys/6986ececf2fc2f0008d9ffaa
😎 Deploy Preview https://deploy-preview-1663--reactplayio.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Hey! contributor, thank you for opening a Pull Request 🎉.

@reactplay/maintainers will review your submission soon and give you helpful feedback. If you're interested in continuing your contributions to open source and want to be a part of a welcoming and fantastic community, we invite you to join our ReactPlay Discord Community.
Show your support by starring ⭐ this repository. Thank you and we appreciate your contribution to open source!
Stale Marking : After 30 days of inactivity this issue/PR will be marked as stale issue/PR and it will be closed and locked in 7 days if no further activity occurs.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes the mobile navigation drawer UX by allowing users to close the drawer when tapping outside the panel, and adds open/close animations via CSS transitions.

Changes:

  • Add overlay click handling to close the mobile nav drawer, while stopping event propagation for clicks inside the drawer panel.
  • Replace display: none/block with visibility + pointer-events to enable smooth slide/fade transitions on mobile.
  • Restructure mobile drawer/overlay styles and add transition effects.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/common/header/HeaderNav.jsx Adds click handling to close the drawer when tapping outside and prevents inside clicks from closing it.
src/common/header/header.css Implements mobile overlay + slide/fade transitions and updates mobile drawer layout rules.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@aniketmishra-0
Copy link
Contributor Author

screen-capture.webm

@priyankarpal priyankarpal merged commit b905e13 into reactplay:main Feb 7, 2026
12 of 13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🐛 [Bug report]: Mobile nav drawer does not close when tapping outside on reactplay.io

2 participants