Skip to content

Commit

Permalink
Soft-Keyboard's scrollTo with regard to scrollableHeader
Browse files Browse the repository at this point in the history
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 54b0e41
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 4 deletions.
8 changes: 7 additions & 1 deletion dist/js/mobile-angular-ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
Loading

0 comments on commit 54b0e41

Please sign in to comment.