fix(scroll): calling ionic scroll methods blur any selected input elements. Closes #2244

This commit is contained in:
Perry Govier
2014-10-27 16:45:01 -05:00
parent 8fae474252
commit 8ee83777f7
3 changed files with 98 additions and 1 deletions

View File

@@ -134,12 +134,14 @@ function($scope, scrollViewOptions, $timeout, $window, $$scrollValueCache, $loca
};
this.scrollTop = function(shouldAnimate) {
ionic.DomUtil.blurAll();
this.resize().then(function() {
scrollView.scrollTo(0, 0, !!shouldAnimate);
});
};
this.scrollBottom = function(shouldAnimate) {
ionic.DomUtil.blurAll();
this.resize().then(function() {
var max = scrollView.getScrollMax();
scrollView.scrollTo(max.left, max.top, !!shouldAnimate);
@@ -147,30 +149,35 @@ function($scope, scrollViewOptions, $timeout, $window, $$scrollValueCache, $loca
};
this.scrollTo = function(left, top, shouldAnimate) {
ionic.DomUtil.blurAll();
this.resize().then(function() {
scrollView.scrollTo(left, top, !!shouldAnimate);
});
};
this.zoomTo = function(zoom, shouldAnimate, originLeft, originTop) {
ionic.DomUtil.blurAll();
this.resize().then(function() {
scrollView.zoomTo(zoom, !!shouldAnimate, originLeft, originTop);
});
};
this.zoomBy = function(zoom, shouldAnimate, originLeft, originTop) {
ionic.DomUtil.blurAll();
this.resize().then(function() {
scrollView.zoomBy(zoom, !!shouldAnimate, originLeft, originTop);
});
};
this.scrollBy = function(left, top, shouldAnimate) {
ionic.DomUtil.blurAll();
this.resize().then(function() {
scrollView.scrollBy(left, top, !!shouldAnimate);
});
};
this.anchorScroll = function(shouldAnimate) {
ionic.DomUtil.blurAll();
this.resize().then(function() {
var hash = $location.hash();
var elm = hash && $document[0].getElementById(hash);
@@ -201,6 +208,7 @@ function($scope, scrollViewOptions, $timeout, $window, $$scrollValueCache, $loca
this._rememberScrollId = null;
};
this.scrollToRememberedPosition = function(shouldAnimate) {
ionic.DomUtil.blurAll();
var values = $$scrollValueCache[this._rememberScrollId];
if (values) {
this.resize().then(function() {