Skip to content

Commit 3c8016b

Browse files
committed
Fix for #118
1 parent 58a25c7 commit 3c8016b

File tree

5 files changed

+59
-10
lines changed

5 files changed

+59
-10
lines changed

CHANGELOG.JSON

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010
"`WebPartTitle`: Added accessibility tags for web part title [#121](https://github.com/SharePoint/sp-dev-fx-controls-react/pull/121)",
1111
"`ListView`: Resizable columns - introduced a `isResizable` property [#119](https://github.com/SharePoint/sp-dev-fx-controls-react/issues/119)"
1212
],
13-
"fixes": []
13+
"fixes": [
14+
"`IFrameDialog`: dialog width is not correct in IE11 [#118](https://github.com/SharePoint/sp-dev-fx-controls-react/issues/118)"
15+
]
1416
},
1517
"contributions": ["Thomas Lamb", "Joel Rodrigues", "Mikael Svenson"]
1618
},

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@
99
- `WebPartTitle`: Added accessibility tags for web part title [#121](https://github.com/SharePoint/sp-dev-fx-controls-react/pull/121)
1010
- `ListView`: Resizable columns - introduced a `isResizable` property [#119](https://github.com/SharePoint/sp-dev-fx-controls-react/issues/119)
1111

12+
**Fixes**
13+
14+
- `IFrameDialog`: dialog width is not correct in IE11 [#118](https://github.com/SharePoint/sp-dev-fx-controls-react/issues/118)
15+
1216
## 1.7.0
1317

1418
**Enhancements**

docs/documentation/docs/about/release-notes.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@
99
- `WebPartTitle`: Added accessibility tags for web part title [#121](https://github.com/SharePoint/sp-dev-fx-controls-react/pull/121)
1010
- `ListView`: Resizable columns - introduced a `isResizable` property [#119](https://github.com/SharePoint/sp-dev-fx-controls-react/issues/119)
1111

12+
**Fixes**
13+
14+
- `IFrameDialog`: dialog width is not correct in IE11 [#118](https://github.com/SharePoint/sp-dev-fx-controls-react/issues/118)
15+
1216
## 1.7.0
1317

1418
**Enhancements**

src/controls/iFrameDialog/IFrameDialog.tsx

Lines changed: 47 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ import * as ReactDOM from "react-dom";
33
import { Dialog, IDialogProps } from 'office-ui-fabric-react/lib/Dialog';
44
import { IFrameDialogContent } from './IFrameDialogContent';
55
import * as telemetry from '../../common/telemetry';
6+
import { Guid } from "@microsoft/sp-core-library";
7+
import omit = require('lodash/omit');
68

79
export interface IFrameDialogProps extends IDialogProps {
810
/**
@@ -24,6 +26,7 @@ export interface IFrameDialogProps extends IDialogProps {
2426
}
2527

2628
export interface IFrameDialogState {
29+
dialogId: string;
2730
}
2831

2932
/**
@@ -35,19 +38,55 @@ export class IFrameDialog extends React.Component<IFrameDialogProps, IFrameDialo
3538
super(props, state);
3639

3740
telemetry.track('IFrameDialog', {});
41+
42+
this.state = {
43+
dialogId: null
44+
};
45+
}
46+
47+
/**
48+
* componentWillMount lifecycle hook
49+
*/
50+
public componentWillMount(): void {
51+
this.setState({
52+
dialogId: `dialog-${Guid.newGuid().toString()}`
53+
});
54+
}
55+
56+
/**
57+
* componentDidMount lifecycle hook
58+
*/
59+
public componentDidMount(): void {
60+
this.setDialogStyling();
61+
}
62+
63+
public componentDidUpdate(prevProps: IFrameDialogProps, prevState: IFrameDialogState): void {
64+
this.setDialogStyling();
3865
}
3966

4067
public render(): JSX.Element {
4168
return (
42-
<Dialog
43-
{...this.props}>
44-
<IFrameDialogContent
45-
url={this.props.url}
46-
iframeOnLoad={this.props.iframeOnLoad}
47-
close={this.props.onDismiss}
48-
width={this.props.width}
49-
height={this.props.height} />
69+
<Dialog className={`${this.state.dialogId} ${this.props.className}`}
70+
{...omit(this.props, "className")}>
71+
<IFrameDialogContent url={this.props.url}
72+
iframeOnLoad={this.props.iframeOnLoad}
73+
close={this.props.onDismiss}
74+
width={this.props.width}
75+
height={this.props.height} />
5076
</Dialog>);
77+
}
5178

79+
/**
80+
* Set the dialog style
81+
*/
82+
private setDialogStyling(): void {
83+
if (!this.props.hidden && this.state.dialogId) {
84+
const element = document.querySelector(`.${this.state.dialogId} .ms-Dialog-main`) as HTMLElement;
85+
if (element && this.props.width) {
86+
element.style.width = this.props.width;
87+
element.style.minWidth = this.props.width;
88+
element.style.maxWidth = this.props.width;
89+
}
90+
}
5291
}
5392
}

src/controls/iFrameDialog/IFrameDialogContent.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,4 @@ export class IFrameDialogContent extends React.Component<IIFrameDialogContentPro
3636

3737
this._iframe.style.visibility = 'visible';
3838
}
39-
}
39+
}

0 commit comments

Comments
 (0)