Visitar URL original
fix(menu): main content is not scrollable while swiping by liamdebeasi · Pull Request #26976 · ionic-team/ionic-framework · GitHub
The Wayback Machine - https://web.archive.org/web/20230321161138/https://github.com/ionic-team/ionic-framework/pull/26976
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

fix(menu): main content is not scrollable while swiping #26976

Merged
merged 4 commits into from Mar 17, 2023
Merged

Conversation

liamdebeasi
Copy link
Member

@liamdebeasi liamdebeasi commented Mar 16, 2023 •

Pull request checklist

Please check if your PR fulfills the following requirements:

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been reviewed and added / updated if needed (for bug fixes / features)
    • Some docs updates need to be made in the ionic-docs repo, in a separate PR. See the contributing guide for details.
  • Build (npm run build) was run locally and any changes were pushed
  • Lint (npm run lint) has passed locally and any fixes were made for failures

Pull request type

Please check the type of change your PR introduces:

  • Bugfix
  • Feature
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • Documentation content changes
  • Other (please describe):

What is the current behavior?

Issue URL: resolves #21193

The .menu-content-open class prevents users from scrolling the content behind a menu when it is open:

pointer-events: none;

However, it does not account for when users accidentally scroll the content while trying to drag the menu open because it is only added once the animation is complete. As a result, it is possible to scroll the content underneath the menu and have the menu gesture activate. This also causes the menu gesture performance to degrade significantly.

What is the new behavior?

  • The .menu-content-open class is added before the open animation starts, preventing any accidental scrolls.

Does this introduce a breaking change?

  • Yes
  • No

Other information

@codeflowapp
Copy link

codeflowapp bot commented Mar 16, 2023

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@github-actions github-actions bot added the package: core @ionic/core package label Mar 16, 2023
@liamdebeasi liamdebeasi marked this pull request as ready for review March 16, 2023 15:41
@amandaejohnston
Copy link
Contributor

I'm not able to replicate the issue on the current main (i.e. without the fix); is there a trick to it? I added a bunch of ion-items to the basic menu test so it's scrollable, and while the menu-content-open class is definitely not added until the gesture is finished, the backdrop-no-scroll class is applied to the <body> as soon as the menu starts opening, which also prevents scrolling.

@liamdebeasi
Copy link
Member Author

It's easier to reproduce if you try it on an actual phone with touch capabilities rather than with touch simulation: #21193 (comment)

I've found it easiest to repro on Chrome for Android if you try to swipe the menu open and then scroll in a circular motion like the video in the linked comment is doing.

Copy link
Contributor

@amandaejohnston amandaejohnston left a comment

Choose a reason for hiding this comment

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

Aha, just saw it. It does take a few tries haha. Looks good on the branch though. 👍

@lincolnthree
Copy link

Will test, thanks @liamdebeasi!

@lincolnthree
Copy link

Looks good here on V7.

@liamdebeasi liamdebeasi merged commit 88bd8a4 into main Mar 17, 2023
45 checks passed
@liamdebeasi liamdebeasi deleted the FW-3752 branch March 17, 2023 20:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package: core @ionic/core package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug: ion-content is still scrollable while ion-menu is opening.
3 participants