From 909f18894ba8872046afe5bc0a28032a3d331f44 Mon Sep 17 00:00:00 2001 From: Corey Frang Date: Tue, 17 Sep 2013 15:26:13 -0400 Subject: [PATCH] Bug 917337 - [Clock] Implement Scrolling for Timer Settings https://bugzilla.mozilla.org/show_bug.cgi?id=917337 - Adds overflow-y: auto to #timer-dialog - Adds a event.preventDefault() on touchstart on the time picker to stop user from scrolling while spinning inputs r=jugglinmike --- apps/clock/js/picker/spinner.js | 13 ++++++++++--- apps/clock/style/timer.css | 1 + 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/apps/clock/js/picker/spinner.js b/apps/clock/js/picker/spinner.js index d44d0e85c42b..fc9a86d35c47 100644 --- a/apps/clock/js/picker/spinner.js +++ b/apps/clock/js/picker/spinner.js @@ -57,7 +57,6 @@ this.timeout = null; - var handler = this.handleEvent.bind(this); var length = this.values.length; var html = ''; var speed = 0; @@ -72,8 +71,9 @@ this.element.innerHTML = html; - this.element.addEventListener('pan', handler, false); - this.element.addEventListener('swipe', handler, false); + this.element.addEventListener('touchstart', this, false); + this.element.addEventListener('pan', this, false); + this.element.addEventListener('swipe', this, false); Object.defineProperties(this, { value: { @@ -129,6 +129,13 @@ this['on' + event.type](event); }; + /** + * ontouchstart - prevent default action (stops scrolling) + */ + Spinner.prototype.ontouchstart = function(event) { + event.preventDefault(); + }; + Spinner.prototype.onpan = function(event) { event.stopPropagation(); var position = event.detail.position; diff --git a/apps/clock/style/timer.css b/apps/clock/style/timer.css index c7db2ba68500..c24beb3d1fa4 100644 --- a/apps/clock/style/timer.css +++ b/apps/clock/style/timer.css @@ -27,6 +27,7 @@ #timer-dialog { position: absolute; width: 100%; + overflow-y: auto; } #timer-active {