bug: scrollBottom() removes focus on input or textareas
Type: bug
Platform: all
When $ionicScrollDelegate.scrollBottom() and .scrollTop() are fired when an input or textarea field is focused, the focus is lost! This behavior is new to beta 14. See this codepen for the issue: http://codepen.io/tsurrel/pen/myRmbe Just type in something in the input field and see how focus is lost, because .scrollBottom() is called. Then replace the beta 14 by beta 13 and see how focus is kept (this should be the intended behavior). Thank you for fixing.
just rebult the function remove ..blurall andfix it
Removing blurall works. So this is actually intended... Sorry for compaining then.
@clawish this is intended behavior? I feel like input blurring should not be a concern of the scroll delegate. In my case, I do NOT want inputs to blur on scrolling.
@clawish can you please share solution using a codepen?
in the ionic.bundle.js change the lines
self.scrollTop = function(shouldAnimate) {
ionic.DomUtil.blurAll();
self.resize().then(function() {
scrollView.scrollTo(0, 0, !!shouldAnimate);
});
};
self.scrollBottom = function(shouldAnimate) {
ionic.DomUtil.blurAll();
self.resize().then(function() {
var max = scrollView.getScrollMax();
scrollView.scrollTo(max.left, max.top, !!shouldAnimate);
});
};
to
self.scrollTop = function(shouldAnimate) {
//ionic.DomUtil.blurAll();
self.resize().then(function() {
scrollView.scrollTo(0, 0, !!shouldAnimate);
});
};
self.scrollBottom = function(shouldAnimate) {
//ionic.DomUtil.blurAll();
self.resize().then(function() {
var max = scrollView.getScrollMax();
scrollView.scrollTo(max.left, max.top, !!shouldAnimate);
});
};
I suggest to add a variable to avoid the blurring, instead of commenting out:
self.scrollTop = function(shouldAnimate, avoidBlur) {
if (avoidBlur !== true){
ionic.DomUtil.blurAll();
}
self.resize().then(function() {
scrollView.scrollTo(0, 0, !!shouldAnimate);
});
};
@panurge-ws nice solution! Would you be so kind and create a pull request? Until now, the "bug" is still in the code.
Could be closed: 0145dc3