Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

now sets klaro-modal-open to body klaro-modal is open #403

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/components/app.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,10 @@ export default class App extends React.Component {
const { additionalClass, embedded, stylePrefix } = config;

const hide = () => {
if (!embedded) this.setState({ show: false });
if (!embedded) {
document.body.classList.remove('klaro-modal-open');
this.setState({ show: false });
}
};
return (
<div
Expand Down
3 changes: 3 additions & 0 deletions src/components/consent-modal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import Purposes from './purposes';
import Text from './text';

export default class ConsentModal extends React.Component {

componentDidMount() {
this.consentModalRef.focus();
}
Expand Down Expand Up @@ -168,6 +169,8 @@ export default class ConsentModal extends React.Component {
if (embedded)
return <div id="cookieScreen" className="cookie-modal cm-embedded">{innerModal}</div>;

document.body.classList.add('klaro-modal-open');

return (
<div id="cookieScreen" className="cookie-modal">
<div className="cm-bg" onClick={hide} />
Expand Down
1 change: 1 addition & 0 deletions src/components/consent-notice.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ export default class ConsentNotice extends React.Component {

const hideModal = () => {
if (config.mustConsent && !config.acceptAll) return;
document.body.classList.remove('klaro-modal-open');
if (manager.confirmed && !testing) this.props.hide();
else this.setState({ modal: false });

Expand Down