Skip to content

Commit d58260d

Browse files
author
bbronisz
committed
Fix doubled scroll issue when iframe content is higher than frame height
1 parent 121af1a commit d58260d

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/controls/iFramePanel/IFramePanelContent.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,14 @@ export class IFramePanelContent extends React.Component<IIFramePanelContentProps
2727
if (this._iframe) {
2828
const mainDiv = this.findParent(this._iframe, "ms-Panel-main");
2929
const commandsDiv = mainDiv.querySelector(".ms-Panel-commands") as HTMLDivElement;
30-
const headerDiv = mainDiv.querySelector("ms-Panel-header") as HTMLDivElement;
31-
const footerDiv = mainDiv.querySelector("ms-Panel-footer") as HTMLDivElement;
30+
const headerDiv = mainDiv.querySelector(".ms-Panel-header") as HTMLDivElement;
31+
const footerDiv = mainDiv.querySelector(".ms-Panel-footer") as HTMLDivElement;
3232

3333
let height = this.getTrueHeight(mainDiv);
3434
height = height - this.getTrueHeight(commandsDiv);
3535
height = height - this.getTrueHeight(headerDiv);
3636
height = height - this.getTrueHeight(footerDiv);
37-
height = height - 20; // padding on content div
37+
height = height - 25; // padding on content div
3838

3939
this._iframe.height = height.toString() + 'px';
4040
}
@@ -59,9 +59,9 @@ export class IFramePanelContent extends React.Component<IIFramePanelContentProps
5959
*/
6060
private getTrueHeight(elm: HTMLElement): number {
6161
if (elm) {
62-
const style = elm.style || window.getComputedStyle(elm);
62+
const style = window.getComputedStyle && window.getComputedStyle(elm) || elm.style;
6363
let marginTop = parseInt((style.marginTop as string).replace("px", ""));
64-
let marginBottom = parseInt((style.marginTop as string).replace("px", ""));
64+
let marginBottom = parseInt((style.marginBottom as string).replace("px", ""));
6565
if (isNaN(marginTop)) {
6666
marginTop = 0;
6767
}

0 commit comments

Comments
 (0)