Skip to content

Fix drawer dismiss behavior on overlay tap#441

Open
Milan-Goswami wants to merge 2 commits into
andoriyaprashant:mainfrom
Milan-Goswami:fix-drawer-overlay-dismiss
Open

Fix drawer dismiss behavior on overlay tap#441
Milan-Goswami wants to merge 2 commits into
andoriyaprashant:mainfrom
Milan-Goswami:fix-drawer-overlay-dismiss

Conversation

@Milan-Goswami

Copy link
Copy Markdown

Fixes #440 (Fix drawer dismiss behavior on overlay tap)

Describe Problem / Root Cause

  • When you open the side menu, there is a blurred background behind it.
  • The problem was that tapping or clicking on this blurred background did not close the menu. Users had to tap the "X" button or swipe left to close it, which was annoying and not how normal apps work.

Solution proposed

  • We wrapped the background of the menu in a GestureDetector so that tapping outside the menu closes it using Navigator.pop(context).
  • We also added a second GestureDetector around the menu box itself with an empty onTap action. This prevents the menu from closing when you click on the actual buttons inside it.
  • Preserved existing swipe gesture behavior as it is.

Additional Information

  • We used HitTestBehavior.translucent for the outer background to make sure the app detects taps on empty or blurred spots.
  • We used HitTestBehavior.opaque for the menu box to stop clicks inside the menu from bubbling up and closing it.

Video Demonstration

  • Solution
Fix.440.mp4

@netlify

netlify Bot commented May 26, 2026

Copy link
Copy Markdown

Deploy Preview for aquamarine-kheer-83feda failed. Why did it fail? →

Name Link
🔨 Latest commit 327d5a5
🔍 Latest deploy log https://app.netlify.com/projects/aquamarine-kheer-83feda/deploys/6a155d0efd1b3a0008688528

@github-actions

Copy link
Copy Markdown

Thank you for submitting your pull request! We'll review it as soon as possible.

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.

BUG: Drawer does not dismiss when tapping outside the overlay

1 participant