Permalink
Browse files

Soft-Keyboard's scrollTo with regard to scrollableHeader

The correct marginTop value is calculated in the event that a
soft-keyboard is showing and a scrollableHeader is present. The
scrollableHeaders height is added to marginTop.

-Edit: line 169 of scrollable.js changed double quotes to single quotes
to pass Travis linting test.
  • Loading branch information...
daniel-prinsloo committed Aug 10, 2016
1 parent f6ffa85 commit 54b0e41df668c6dba5c401e53c47dd704a6ea702
@@ -3233,7 +3233,13 @@
// since an input got focus we assume soft keyboard is showing.
//
if (h1 > h2) {
scrollable.scrollTo(elem, 10);
var marginTop = 10;
//if scrollableHeader is present increase the marginTop to compensate for scrollableHeader's height.
var scrollableHeader = scrollable.scrollableContent.parentElement.querySelector('.scrollable-header');
if (scrollableHeader) {
marginTop = (scrollableHeader.getBoundingClientRect().bottom - scrollableHeader.getBoundingClientRect().top) + marginTop;
}
scrollable.scrollTo(elem, marginTop);
}
}, 500);
}
Oops, something went wrong.

0 comments on commit 54b0e41

Please sign in to comment.