ionic-team / ionic-framework

A powerful cross-platform UI toolkit for building native-quality iOS, Android, and Progressive Web Apps with HTML, CSS, and JavaScript.
https://ionicframework.com
MIT License
51.13k stars 13.5k forks source link

bug: menu can be swiped to open when not on root page #25272

Open WhatsThatItsPat opened 2 years ago

WhatsThatItsPat commented 2 years ago

Prerequisites

Ionic Framework Version

Current Behavior

If you've pushed a few pages onto the stack, swiping from the left edge of the screen should pop pages off the stack. Only when you're at a nav root should swiping from the left expose the side menu.

But if you swipe from the left edge before a push or pop navigation animation has settled, you can drag out the side menu when you're not at the root of the nav stack.

Expected Behavior

Pushed pages should prevent the side menu swipeGesture from working until you're at the root.

Steps to Reproduce

This video explains it.

https://youtu.be/qTidttFLsZQ

Code Reproduction URL

https://github.com/WhatsThatItsPat/sidemenu-available-in-subpage

Ionic Info

Ionic:

Ionic CLI : 6.19.1 Ionic Framework : not installed @angular-devkit/build-angular : not installed @angular-devkit/schematics : not installed @angular/cli : not installed @ionic/angular-toolkit : not installed

Capacitor:

Capacitor CLI : not installed @capacitor/android : not installed @capacitor/core : not installed @capacitor/ios : not installed

Utility:

cordova-res : not installed globally native-run : 1.5.0

System:

NodeJS : v16.13.2 npm : 8.1.2 OS : macOS Big Sur

Additional Information

No response

liamdebeasi commented 2 years ago

Thanks for the issue. I was able to reproduce this by pushing a page and then swiping from left to right on the tab bar.

We rely on the swipe to go back gesture to activate first in order to prevent the menu from opening, but this is not reliable. In this case, swiping on the tab bar should never activate swipe to go back.

We could have the router disable/re-enable the swipe gesture at the correct time, but tightly coupling the menu with the router is probably not a good idea. Right now the menu gesture gets attached to contentId (usually ion-router-outlet). There is likely some mechanism we can introduce to get this to behave as expected, but more research is needed.