[FIX] point_of_sale: undo mobile browser autoscroll in client list

Mobile browsers attempt to scroll invisible input elements into
view (eg. when they end up hidden behind the on-screen keyboard). The
browser does not always correctly undo this. This is problematic
because the main window in the client list is not actually scrollable
for the user, so you ended up with part of the widget cut off. This
implements a workaround that scrolls to top when input elements are
blurred. Removing the blur handlers is not necessary because the input
elements get removed.

opw-706781
This commit is contained in:
Joren Van Onder
2017-04-06 17:01:22 -07:00
parent c8a434306f
commit d17c302c0a
@@ -1319,6 +1319,16 @@ var ClientListScreenWidget = ScreenWidget.extend({
contents.append($(QWeb.render('ClientDetailsEdit',{widget:this,partner:partner})));
this.toggle_save_button();
// Browsers attempt to scroll invisible input elements
// into view (eg. when hidden behind keyboard). They don't
// seem to take into account that some elements are not
// scrollable.
contents.find('input').blur(function() {
setTimeout(function() {
self.$('.window').scrollTop(0);
}, 0);
});
contents.find('.image-uploader').on('change',function(event){
self.load_image_file(event.target.files[0],function(res){
if (res) {