Skip to content

Commit 1811cf8

Browse files
authored
Merge pull request #371 from daniel-prinsloo/master
Soft-Keyboard's scrollTo with regard to scrollableHeader
2 parents 07d34e6 + 54b0e41 commit 1811cf8

File tree

4 files changed

+16
-4
lines changed

4 files changed

+16
-4
lines changed

dist/js/mobile-angular-ui.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3233,7 +3233,13 @@
32333233
// since an input got focus we assume soft keyboard is showing.
32343234
//
32353235
if (h1 > h2) {
3236-
scrollable.scrollTo(elem, 10);
3236+
var marginTop = 10;
3237+
//if scrollableHeader is present increase the marginTop to compensate for scrollableHeader's height.
3238+
var scrollableHeader = scrollable.scrollableContent.parentElement.querySelector('.scrollable-header');
3239+
if (scrollableHeader) {
3240+
marginTop = (scrollableHeader.getBoundingClientRect().bottom - scrollableHeader.getBoundingClientRect().top) + marginTop;
3241+
}
3242+
scrollable.scrollTo(elem, marginTop);
32373243
}
32383244
}, 500);
32393245
}

0 commit comments

Comments
 (0)