From 4a00d0b8d4fa00920885450f444051600db63845 Mon Sep 17 00:00:00 2001 From: Valdrin Koshi Date: Tue, 19 Jul 2016 16:18:13 -0700 Subject: [PATCH] keep overflow, prevent events that cause scrolling (#93) * keep overflow, calculate scroll size * check either horizontal or vertical scroll delta, not both * restore scroll position when scroll happens * scroll listener on dropdown, call refit if allowScrollOutside * normalize wheel delta * prevent scrolling keys * store EVENT_PATH on touchstart * use touches to find the deltaX/Y * restore elementIsScrollLocked, make _shouldPreventScrolling private * ensure touchstart is prevented only if happens outside the locking element * ensure touchstart is not prevented * store last touch position instead of the event * return an object scrollDeltaInfo since event.deltaX is readonly * store only scrollable nodes * avoid preventing events that are not cancelable, e.g. scroll that cannot be interrupted * fix bug on touch events, update docs * check only one axis according to where there is more scroll --- iron-dropdown-scroll-manager.html | 219 ++++++++++++++++++++----- iron-dropdown.html | 69 +++++++- test/iron-dropdown-scroll-manager.html | 56 ++++--- test/iron-dropdown.html | 104 +++++++++--- test/x-scrollable-element.html | 30 +++- 5 files changed, 392 insertions(+), 86 deletions(-) diff --git a/iron-dropdown-scroll-manager.html b/iron-dropdown-scroll-manager.html index 5e9176e..8b48d1d 100644 --- a/iron-dropdown-scroll-manager.html +++ b/iron-dropdown-scroll-manager.html @@ -14,6 +14,14 @@ + diff --git a/test/iron-dropdown.html b/test/iron-dropdown.html index dffc458..0dcfecd 100644 --- a/test/iron-dropdown.html +++ b/test/iron-dropdown.html @@ -9,6 +9,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt --> + iron-dropdown basic tests @@ -54,6 +55,7 @@ height: 3000px; } + @@ -133,6 +135,7 @@ + + diff --git a/test/x-scrollable-element.html b/test/x-scrollable-element.html index a3012e2..3bdb3cf 100644 --- a/test/x-scrollable-element.html +++ b/test/x-scrollable-element.html @@ -12,11 +12,37 @@