-
Notifications
You must be signed in to change notification settings - Fork 27
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
Abort paper ripple when scrolling on touch devices #66
Comments
@MajorBreakfast Calling document.addEventListener('scroll', function() {
this.getRipple().uiUpAction();
}); Of course, this gets complicated if the element is inside an element scroller (i.e. not the document scroller), so this behavior is probably more suitable at the user-level. |
@keanulee Using About document vs element scroller: I've never built a web app that is a document scroller. That's too constrained for me. I'm always scrolling inside elements. I'm using Polymer mostly because it lets me build great looking apps. I don't want my app to be recognized as a web app too easily. Scroll indicators on top of the toolbar would be a giveaway. So, never document scroller :) About the performance cost of I think what's really needed here is different events like I've added a quick-fix in my app: listeners: {
'touchmove': '_onTouchMove'
},
_onTouchMove: function (event) {
var rippleEl = this.getRipple()
rippleEl.ripples.map(function (r) { rippleEl.removeRipple(r) })
} That's not a good general solution though, because it detects false positives. I'm not using |
I've played around some more and I come to the conclusion that it'd be best if the ripple only appeared once a tap is detected. That's the way it is done in android, e.g. the settings app. So, buttons should behave differently depending on whether they're inside a scrollable area or not:
Maybe an attribute to switch between the behaviors could be introduced: |
@keanulee @MajorBreakfast what is the best approach for this now? I currently have the same issue. |
@imolorhe I placed a ...
<dom-module id="my-element">
<template>
<style>
:host { position: relative; }
#rippleContainer { pointer-events: none; }
</style>
...
<div id="rippleContainer">
<paper-ripple id="ripple"></paper-ripple>
</div>
</template>
<script>
Polymer({
is: 'my-element',
listeners: {
'tap': '_onTap'
},
_onTap: function (event) {
this.$.ripple.uiDownAction(event)
this.$.ripple.uiUpAction(event)
...
}
})
</script>
</dom-module> Just a workaround, though. (It's been a while. Come the think about it, the wrapping |
@MajorBreakfast Thanks! This helped a lot! I had to reuse it for my purpose though, since mine was a list component with several ripples in it. |
@imolorhe Glad I could help :) |
Scrolling on touch devices triggers the ripple effect which is really distracting. It'd be great if the ripple could start as normal but aborts if a scroll is detected. Maybe using
requestAnimationFrame
andelement.getBoundingClientRect()
to detect if the element was moved?The text was updated successfully, but these errors were encountered: