Skip to content
This repository was archived by the owner on Sep 5, 2024. It is now read-only.

fix(gestures): slider and swipe touch #10314

Merged
merged 1 commit into from
Jan 31, 2017
Merged

fix(gestures): slider and swipe touch #10314

merged 1 commit into from
Jan 31, 2017

Conversation

EladBezalel
Copy link
Member

pan-x: The browser is only allowed to perform the horizontal scroll default action.

that means we should had enabled pan-y and vice-versa instead.

  • swipe directive didn't had any touch-action css styles, added touch-action: none on the directive element on link

fixes #10294, #10187, #10145

- slider was based on mdGesture service that set `touch-action: pan-x` in case the gesture was horizontal;
according the google pointer-events documentation:
```
pan-x: The browser is only allowed to perform the horizontal scroll default action.
```
that means we should had enabled `pan-y` and vice-versa instead.

- swipe directive didn't had any `touch-action` css styles, added `touch-action: none` on the directive element on link

fixes #10294, #10187, #10145
@EladBezalel EladBezalel requested a review from jelbourn January 27, 2017 13:39
@googlebot googlebot added the cla: yes PR author has signed Google's CLA: https://opensource.google.com/docs/cla/ label Jan 27, 2017
Copy link
Contributor

@clshortfuse clshortfuse left a comment

Choose a reason for hiding this comment

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

Tested on touchscreen hardware

  • Chrome v55 on Windows 10
  • Chrome v55 on ChromeOS
  • Chrome v55 on Android 7.0
  • Microsoft Edge on Windows 10
  • Firefox v51* on Windows 10

* via device emulator, since Firefox did not properly detect my touchscreen

iOS device tests passed via Browserstack testing

Internet Explorer 11 isn't working, but it wasn't working in master either, so no regression noted.

@@ -248,7 +248,7 @@ function MdGesture($$MdGestureHandler, $$rAF, $timeout) {
if (touchActionProperty) {
// We check for horizontal to be false, because otherwise we would overwrite the default opts.
this.oldTouchAction = element[0].style[touchActionProperty];
element[0].style[touchActionProperty] = options.horizontal === false ? 'pan-y' : 'pan-x';
element[0].style[touchActionProperty] = options.horizontal ? 'pan-y' : 'pan-x';
Copy link
Member

Choose a reason for hiding this comment

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

I think I initially wrote that lines and I think it was intentional to only allow pan-x for horizontal gestures and pan-y for vertical gestures.

Can you explain more why this needs to be the other way around?

State Value Description
horizontal pan-x Only recognize X-Axis movement s
vertical pan-y Only recognize Y-Axis movements

Copy link
Member Author

@EladBezalel EladBezalel Jan 27, 2017

Choose a reason for hiding this comment

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

Cause it's the other way around:

Value Description
pan-x The browser is only allowed to perform the horizontal scroll default action.
pan-y The browser is only allowed to perform the vertical scroll default action.

Therefor we need

State Value
horizontal pan-y
vertical pan-x

@jelbourn
Copy link
Member

Tried this with Chrome 55 and Edge on a MS Surface and everything was peachy. Thanks! LGTM

@kara kara added pr: merge ready This PR is ready for a caretaker to review and removed needs: presubmit labels Jan 31, 2017
@kara kara merged commit b2562cf into master Jan 31, 2017
@crownofapollo
Copy link

This now break my application; I have an md-tabs with md-dynamic-height inside a layout-full and an md-content. Vertical scrolling in the md-content no longer works.

davidenochk pushed a commit to davidenochk/material that referenced this pull request Feb 3, 2017
@xcafebabe
Copy link

xcafebabe commented Feb 4, 2017

Same scenario described by @crownofapollo . Vertical srolling in md-content no longer works with 1.1.3

@EladBezalel EladBezalel deleted the fix/gestures branch February 5, 2017 22:59
@EladBezalel
Copy link
Member Author

EladBezalel commented Feb 5, 2017

@crownofapollo @xcafebabe what touch device? os? can you file a proper issue with a plunker/codepen so we can investigate further?
Vertical srolling in md-content works for me (win10 touchscreen)

@xcafebabe
Copy link

xcafebabe commented Feb 6, 2017

Hi @EladBezalel,

I send you two codepens with same code, turn on Device mode in Chrome and swipe up and down.

With 1.1.2: swipe up-down works.
http://codepen.io/xcafebabe/pen/zNaJBq

With 1.1.3: swipe up-down does not work
http://codepen.io/xcafebabe/pen/NdzLbJ

Tested with
Jessie Debian, Chrome 56.0.2924.87 (64-bit) and without using touch screen, but I'm also experiencing same behavior in an Android 6 mobile device (LG G3), either using google chrome app or an android webview, both version 55.0.2883.91.

Nevertheless thanks for the great work you are doing! :)

@Paul-Reed
Copy link

@EladBezalel Thanks for looking at this, but I'm also unable to swipe up-down too - Android 6 (HTC1)
Issue seems to be confined to Chrome browser, as works fine on Firefox...

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla: yes PR author has signed Google's CLA: https://opensource.google.com/docs/cla/ pr: merge ready This PR is ready for a caretaker to review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

md-slider not working in chrome on windows touch devices
10 participants