diff --git a/packages/patternfly-4/react-core/src/components/AboutModal/AboutModal.js b/packages/patternfly-4/react-core/src/components/AboutModal/AboutModal.js
index 6eb878546b7..01bf079b78b 100644
--- a/packages/patternfly-4/react-core/src/components/AboutModal/AboutModal.js
+++ b/packages/patternfly-4/react-core/src/components/AboutModal/AboutModal.js
@@ -4,6 +4,8 @@ import PropTypes from 'prop-types';
import AboutModalContainer from './AboutModalContainer';
import { canUseDOM } from 'exenv';
import { KEY_CODES } from '../../internal/constants';
+import { css } from '@patternfly/react-styles';
+import styles from '@patternfly/patternfly-next/components/Backdrop/backdrop.css';
const propTypes = {
/** content rendered inside the About Modal. */
@@ -57,6 +59,19 @@ class AboutModal extends React.Component {
componentDidMount() {
document.body.appendChild(this.container);
document.addEventListener('keydown', this.handleEscKeyClick, false);
+ if (this.props.isOpen) {
+ document.body.classList.add(css(styles.backdropOpen));
+ } else {
+ document.body.classList.remove(css(styles.backdropOpen));
+ }
+ }
+
+ componentDidUpdate() {
+ if (this.props.isOpen) {
+ document.body.classList.add(css(styles.backdropOpen));
+ } else {
+ document.body.classList.remove(css(styles.backdropOpen));
+ }
}
componentWillUnmount() {
diff --git a/packages/patternfly-4/react-core/src/components/AboutModal/AboutModal.test.js b/packages/patternfly-4/react-core/src/components/AboutModal/AboutModal.test.js
index 6783849ebba..547c19ce14a 100644
--- a/packages/patternfly-4/react-core/src/components/AboutModal/AboutModal.test.js
+++ b/packages/patternfly-4/react-core/src/components/AboutModal/AboutModal.test.js
@@ -22,11 +22,11 @@ const props = {
heroImageSrc: 'heroImg...'
};
-test('AboutModal creates a container element once', () => {
+test('AboutModal creates a container element once for div', () => {
const view = shallow( Test About Modal );
view.update();
expect(document.createElement).toBeCalledWith('div');
- expect(document.createElement).toHaveBeenCalledTimes(1);
+ expect(document.createElement).toHaveBeenCalledTimes(3);
});
test('About Modal closes with escape', () => {
diff --git a/packages/patternfly-4/react-core/src/components/Modal/Modal.js b/packages/patternfly-4/react-core/src/components/Modal/Modal.js
index 62e00be2d59..d7a436767e1 100644
--- a/packages/patternfly-4/react-core/src/components/Modal/Modal.js
+++ b/packages/patternfly-4/react-core/src/components/Modal/Modal.js
@@ -4,6 +4,8 @@ import PropTypes from 'prop-types';
import ModalContent from './ModalContent';
import { canUseDOM } from 'exenv';
import { KEY_CODES } from '../../internal/constants';
+import { css } from '@patternfly/react-styles';
+import styles from '@patternfly/patternfly-next/components/Backdrop/backdrop.css';
const propTypes = {
/** content rendered inside the Modal. */
@@ -50,6 +52,19 @@ class Modal extends React.Component {
componentDidMount() {
document.body.appendChild(this.container);
document.addEventListener('keydown', this.handleEscKeyClick, false);
+ if (this.props.isOpen) {
+ document.body.classList.add(css(styles.backdropOpen));
+ } else {
+ document.body.classList.remove(css(styles.backdropOpen));
+ }
+ }
+
+ componentDidUpdate() {
+ if (this.props.isOpen) {
+ document.body.classList.add(css(styles.backdropOpen));
+ } else {
+ document.body.classList.remove(css(styles.backdropOpen));
+ }
}
componentWillUnmount() {
diff --git a/packages/patternfly-4/react-core/src/components/Modal/Modal.test.js b/packages/patternfly-4/react-core/src/components/Modal/Modal.test.js
index 400c66b13a6..398b851c7ac 100644
--- a/packages/patternfly-4/react-core/src/components/Modal/Modal.test.js
+++ b/packages/patternfly-4/react-core/src/components/Modal/Modal.test.js
@@ -17,11 +17,11 @@ const props = {
children: 'modal content'
};
-test('Modal creates a container element once', () => {
+test('Modal creates a container element once for div', () => {
const view = shallow();
view.update();
expect(document.createElement).toBeCalledWith('div');
- expect(document.createElement).toHaveBeenCalledTimes(1);
+ expect(document.createElement).toHaveBeenCalledTimes(3);
});
test('modal closes with escape', () => {