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(range): disable scroll when range is being dragged #29241

Merged
merged 6 commits into from
Sep 11, 2024
Merged

fix(range): disable scroll when range is being dragged #29241

merged 6 commits into from
Sep 11, 2024

Conversation

thetaPC
Copy link
Contributor

@thetaPC thetaPC commented Mar 29, 2024

Issue number: internal

What is the current behavior?

There are a few tests that were disabled due to being flaky from gestures.

What is the new behavior?

While fixing the tests, I found a bug that the scroll was never being disabled on scroll. Additionally, we were not taking into account that a custom scroll target could be used so it was never disabled either.

  • Fixed the flaky tests.
  • Content doesn't scroll when range is being dragged.
  • Content can be either ion-content or a custom scroll target.

Does this introduce a breaking change?

  • Yes
  • No

Other information

Preview for ion-content
Preview for custom scroll target

How to test:

  1. Open either of the previews
  2. Render the screen with the device simulator from the browser
  3. Verify that you can scroll the page
  4. Drag the range but don't let go
  5. Verify that you cannot scroll the page
  6. Repeat steps 2-5 with the other preview

@github-actions github-actions bot added the package: core @ionic/core package label Mar 29, 2024
Copy link

vercel bot commented Apr 18, 2024

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

Name Status Preview Comments Updated (UTC)
ionic-framework ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 18, 2024 9:25pm

@@ -325,7 +325,8 @@ export class Range implements ComponentInterface {
this.setupGesture();
}

this.contentEl = findClosestIonContent(this.el);
const ionContent = findClosestIonContent(this.el);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The scroll target test was failing because we didn't take into account that there might be a custom scroll target.

@@ -418,7 +419,7 @@ export class Range implements ComponentInterface {
*
* This only needs to be done once.
*/
if (contentEl && this.initialContentScrollY === undefined) {
if (contentEl && this.pressedKnob === undefined) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The scroll was never being disabled which lead to flaky results.

@@ -99,31 +107,6 @@ configs({ modes: ['ios'], directions: ['ltr'] }).forEach(({ title, config }) =>

expect(rangeEndSpy.length).toBe(1);
});

// TODO FW-2873
test.skip('should not scroll when the knob is swiped', async ({ page, skip }) => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved this test to it's own test page to properly test the scroll since the basic page didn't have enough content to scroll on.

@thetaPC thetaPC changed the title test(range): remove gesture flakiness fix(range): disable scroll when range is being dragged Jul 18, 2024
@thetaPC thetaPC marked this pull request as ready for review July 18, 2024 22:49
@thetaPC thetaPC requested a review from a team as a code owner July 18, 2024 22:49
Copy link
Member

@brandyscarney brandyscarney left a comment

Choose a reason for hiding this comment

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

LGTM

@thetaPC thetaPC added this pull request to the merge queue Sep 11, 2024
Merged via the queue into main with commit 35b1a45 Sep 11, 2024
50 checks passed
@thetaPC thetaPC deleted the FW-2873 branch September 11, 2024 16:50
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.

2 participants