Skip to content
This repository has been archived by the owner on Dec 8, 2022. It is now read-only.

Commit

Permalink
Add max-height to modal content on window resize for ie11 bug (#567)
Browse files Browse the repository at this point in the history
  • Loading branch information
Blackbaud-PatrickOFriel authored Apr 10, 2017
1 parent 44e3ee7 commit dae4600
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/modules/modal/modal-component-adapter.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,15 @@ export class SkyModalComponentAdapterService {
if (fullPageModalEl) {
fullPageModalEl.style.height = window.innerHeight.toString() + 'px';
fullPageModalEl.style.maxHeight = window.innerHeight.toString() + 'px';
} else {
/*
IE11 doesn't handle flex and max-height correctly so we have to explicitly add
max-height to the content that accounts for standard header and footer height.
*/
let modalContentEl = modalEl.nativeElement.querySelector('.sky-modal-content');
let contentHeight = newHeight - 114;
modalContentEl.style.maxHeight = contentHeight.toString() + 'px';

}
}
}
4 changes: 4 additions & 0 deletions src/modules/modal/modal.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,12 @@ describe('Modal component', () => {
let modalEl = document.querySelector('.sky-modal');
let maxHeight = parseInt(getComputedStyle(modalEl).maxHeight, 10);
let windowHeight = window.innerHeight;
let contentEl = modalEl.querySelector('.sky-modal-content');

let contentHeight = parseInt(getComputedStyle(contentEl).maxHeight, 10);

expect(maxHeight).toEqual(windowHeight - 40);
expect(contentHeight).toEqual(windowHeight - 40 - 114);

TestUtility.fireDomEvent(window, 'resize');
applicationRef.tick();
Expand Down

0 comments on commit dae4600

Please sign in to comment.