You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(modal): prevent body content shifting when vertical scrollbar
- If body has vertical scrollbar and appendTo element is 'body', add right padding to body equivalent to scrollbar width. Also, conditionally add right or left padding to modal window
Closesangular-ui#3714
// if modal is attached to body, then check if body is overflowing and set bodyOverflowing property on modal object and set right padding equal to scrollbarWidth
Copy file name to clipboardexpand all lines: src/modal/test/modal.spec.js
+52
Original file line number
Diff line number
Diff line change
@@ -1225,4 +1225,56 @@ describe('$uibModal', function () {
1225
1225
expect(called).toBeTruthy();
1226
1226
});
1227
1227
});
1228
+
1229
+
describe('body content when vertical scrollbar present',function(){
1230
+
it('should not shift document elements - no body right padding specified',function(){
1231
+
1232
+
varlargeBlockWithButton='<div class="container"><button class="btn btn-default" id="clickMeButton" ng-click="open()">Open me!</button><div style="height: 3000px;"><p> </p><p>Block with large height to force vertical scroll</p></div></div></div>';
it('should not shift document elements - body has right padding specified',function(){
1254
+
1255
+
// add right body padding
1256
+
varbody=$document.find('body').eq(0);
1257
+
body.css('padding-right','50px');
1258
+
1259
+
varlargeBlockWithButton='<div class="container"><button class="btn btn-default" id="clickMeButton" ng-click="open()">Open me!</button><div style="height: 3000px;"><p> </p><p>Block with large height to force vertical scroll</p></div></div></div>';
0 commit comments