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

Disable native snap point in slidescroll #7966

Merged
merged 6 commits into from Mar 17, 2017

Conversation

muxin
Copy link
Contributor

@muxin muxin commented Mar 3, 2017

Fixes #7670

Tested in ios 10.3 beta and 10.2

@camelburrito
Copy link
Contributor

tested on other devices? platforms?

@muxin muxin force-pushed the slidescroll-disable-native-snap branch from d6e8332 to aaf8b63 Compare March 3, 2017 22:06
@camelburrito
Copy link
Contributor

Also this is not a permanent fix , this is just a stop gap. So just flip the flag in the JS dont cleanup the code yet. We would need a permanant fix (or may be identify the issue and file a webkit bug that would be fixed soon)

@muxin
Copy link
Contributor Author

muxin commented Mar 3, 2017

I just tested the code (disable native snap point) on real ios device and the autoplay iterating rapidly bug is fixed but there are other misbehaviors showing up. @camelburrito

PS, I tried to debug what's wrong with the native snap point but didn't have a clue.

@muxin
Copy link
Contributor Author

muxin commented Mar 3, 2017

I'm going to debug slidescroll custom snap and hopefully find a fix for the newly found misbehaviour: if user scrolls too much and reach the end of the next slide, the carousel will jump one more slide suddenly.

@muxin
Copy link
Contributor Author

muxin commented Mar 4, 2017

Thanks to @camelburrito I figured out the fix for the sudden slide jump in ios. I will keep testing and commit coming.

@muxin muxin force-pushed the slidescroll-disable-native-snap branch from aaf8b63 to f3b62cd Compare March 10, 2017 19:48
@muxin
Copy link
Contributor Author

muxin commented Mar 10, 2017

@camelburrito I removed handleCustomElasticScroll_ and the problem (jumping to one more slide suddenly) is solved. I removed it in both android and ios cases and confirmed the slidescroll still functional in both platforms. Do you think it's ok to remove it?

@amphtml-team
Copy link

amphtml-team commented Mar 11, 2017 via email

@muxin
Copy link
Contributor Author

muxin commented Mar 11, 2017

@camelburrito I updated the heroku code with current PR code: http://yuxichen2.herokuapp.com/examples/test.amp.max.html (I added a test.amp.html in the heroku deployment), please check the swiping behavior. It seems great, I wonder why can't we remove handleCustomElasticScroll_

@muxin muxin force-pushed the slidescroll-disable-native-snap branch from 76a8a6b to 9f7dbac Compare March 14, 2017 17:51
@ampprojectbot
Copy link
Member

Hi, ampproject bot here! Here are a list of the owners that can approve your files.

You may leave an issue comment stating "@ampprojectbot retry!" to force me to re-evaluate this Pull Request's status

/to cramforce dvoytenko

  • extensions/amp-carousel/0.1/amp-carousel.css
  • extensions/amp-carousel/0.1/slidescroll.js
  • extensions/amp-carousel/0.1/test/test-slidescroll.js

For any issues please file a bug at https://github.com/google/github-owners-bot/issues

@muxin muxin force-pushed the slidescroll-disable-native-snap branch from 9f7dbac to 09776d2 Compare March 14, 2017 17:53
@jridgewell
Copy link
Contributor

Ping @camelburrito @muxin, this is a P0.

@camelburrito
Copy link
Contributor

@jridgewell - we are working on it we have a solution and we are testing it out on lots of devices - taking a lot of time. @muxin Let me know when the device testing is done.

@muxin muxin force-pushed the slidescroll-disable-native-snap branch from 09776d2 to 30cf942 Compare March 14, 2017 20:16
@ampprojectbot
Copy link
Member

Hi, ampproject bot here! Here are a list of the owners that can approve your files.

You may leave an issue comment stating "@ampprojectbot retry!" to force me to re-evaluate this Pull Request's status

/to camelburrito dvoytenko

  • extensions/amp-carousel/0.1/amp-carousel.css
  • extensions/amp-carousel/0.1/slidescroll.js
  • extensions/amp-carousel/0.1/test/test-slidescroll.js

For any issues please file a bug at https://github.com/google/github-owners-bot/issues

@muxin muxin force-pushed the slidescroll-disable-native-snap branch from 30cf942 to 686021c Compare March 16, 2017 20:43
@ampprojectbot
Copy link
Member

Hi, ampproject bot here! Here are a list of the owners that can approve your files.

You may leave an issue comment stating "@ampprojectbot retry!" to force me to re-evaluate this Pull Request's status

/to cramforce dvoytenko jridgewell

  • tools/experiments/experiments.js

/to camelburrito dvoytenko

  • extensions/amp-carousel/0.1/amp-carousel.css
  • extensions/amp-carousel/0.1/slidescroll.js
  • extensions/amp-carousel/0.1/test/test-slidescroll.js

For any issues please file a bug at https://github.com/google/github-owners-bot/issues

@muxin muxin force-pushed the slidescroll-disable-native-snap branch from 686021c to e337a6c Compare March 16, 2017 20:46
@muxin muxin force-pushed the slidescroll-disable-native-snap branch from e337a6c to 69c50ae Compare March 16, 2017 20:49
@muxin
Copy link
Contributor Author

muxin commented Mar 16, 2017

@camelburrito Testing on devices. But PTAL

@muxin
Copy link
Contributor Author

muxin commented Mar 16, 2017

Tested, the android and ios non-beta behaves the same as before, and the ios beta uses custom snap without crazy slide switching. @camelburrito PTAL


/** @private {boolean} */
this.isIosBeta_ = startsWith(platformFor(this.win).getIosVersionString(),
'10.3');
Copy link
Contributor

Choose a reason for hiding this comment

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

you should check if the version is > 10.2

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right now the 10.3 is the only problematic version, I will create a followup issue for comparing IOS minor version.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Created #8206

/** @private {boolean} */
this.isIosBetaExperimentOn_ = isExperimentOn(this.win,
'slidescroll-ios-beta');

Copy link
Contributor

Choose a reason for hiding this comment

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

disable-css-snap

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

'slidescroll-ios-beta');

/** @private {boolean} */
this.isIosBeta_ = startsWith(platformFor(this.win).getIosVersionString(),
Copy link
Contributor

Choose a reason for hiding this comment

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

isCssSnapDisabled_

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@@ -139,6 +155,11 @@ export class AmpSlideScroll extends BaseSlides {
// user.
this.slidesContainer_.setAttribute('aria-live', 'polite');

// Snap point is buggy in IOS 10.3 (beta), so it is disabled in beta.
if (this.isIosBetaExperimentOn_ && this.isIosBeta_) {
this.slidesContainer_.classList.add('-amp-disable-snap-type');
Copy link
Contributor

Choose a reason for hiding this comment

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

-amp-slidescroll-dsable-snap

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done


// Snap point is buggy in IOS 10.3 (beta), so it is disabled in beta.
if (this.isIosBetaExperimentOn_ && this.isIosBeta_) {
slideWrapper.classList.add('-amp-disable-snap-coordinate');
Copy link
Contributor

Choose a reason for hiding this comment

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

use only one class

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@@ -180,4 +180,12 @@ amp-carousel .amp-carousel-button.amp-disabled {
overflow-y: hidden !important;
-webkit-overflow-scrolling: touch !important;
}

.-amp-disable-snap-type {
Copy link
Contributor

Choose a reason for hiding this comment

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

.-amp-slidescroll-no-snap..-amp-slides-container {
  scroll-snap-type: none !important;
}

.-amp-slidescroll-no-snap.-amp-slide-item {
  scroll-snap-coordinate: none !important;
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

{
id: 'slidescroll-ios-beta',
name: 'Slidescroll IOS beta',
cleanupIssue: 'https://github.com/ampproject/amphtml/issues/8195',
Copy link
Contributor

Choose a reason for hiding this comment

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

add a spec and link the issue.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@@ -266,6 +266,11 @@ const EXPERIMENTS = [
spec: 'https://github.com/ampproject/amphtml/blob/master/extensions/' +
'amp-sortable-table/amp-sortable-table.md',
},
{
id: 'slidescroll-ios-beta',
Copy link
Contributor

Choose a reason for hiding this comment

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

change the expt name.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@muxin muxin removed the request for review from aghassemi March 16, 2017 23:43
'slidescroll-disable-css-snap');

/** @private {boolean} */
this.shouldDisableCssSnap_ = startsWith(
Copy link
Contributor

Choose a reason for hiding this comment

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

bring in the experiment here and use one boolean.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@muxin muxin merged commit 6a4b67b into ampproject:master Mar 17, 2017
@muxin muxin deleted the slidescroll-disable-native-snap branch March 17, 2017 01:15
mrjoro pushed a commit to mrjoro/amphtml that referenced this pull request Apr 28, 2017
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.

None yet

5 participants