Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
getContainerDimensions(containerNode) {
let width, height, scroll;
if (containerNode.tagName === 'BODY') {
width = window.innerWidth;
height = window.innerHeight;
scroll = scrollTop(ownerDocument(containerNode).documentElement) || scrollTop(containerNode);
} else {
({ width, height } = getOffset(containerNode));
scroll = scrollTop(containerNode);
}
return { width, height, scroll };
},
getStyles(dialogElement?: HTMLElement) {
const { container, overflow, drawer } = this.props;
const node: any = dialogElement || this.dialogRef.current;
const doc: any = ownerDocument(node);
const scrollHeight = node ? node.scrollHeight : 0;
const bodyIsOverflowing = isOverflowing(container || doc.body);
const modalIsOverflowing = scrollHeight > doc.documentElement.clientHeight;
const styles: {
modalStyles: React.CSSProperties;
bodyStyles: React.CSSProperties;
} = {
modalStyles: {
[isRTL() ? 'paddingLeft' : 'paddingRight']:
bodyIsOverflowing && !modalIsOverflowing ? getScrollbarSize() : 0,
[isRTL() ? 'paddingRight' : 'paddingLeft']:
!bodyIsOverflowing && modalIsOverflowing ? getScrollbarSize() : 0
},
bodyStyles: {}
_mountOverlayTarget() {
if (!this._overlayTarget) {
this._overlayTarget = document.createElement('div');
this._portalContainerNode = getContainer(this.props.container, ownerDocument(this).body);
this._portalContainerNode.appendChild(this._overlayTarget);
}
},
onShow() {
let doc = ownerDocument(this);
let container = getContainer(this.props.container, doc.body);
modalManager.add(this, container, this.props.containerClassName);
this._onDocumentKeyupListener = on(doc, 'keyup', this.handleDocumentKeyUp);
this._onFocusinListener = onFocus(this.enforceFocus);
this.focus();
if (this.props.onShow) {
this.props.onShow();
}
},