Anchor modal to proper element

By default all modals are anchored to document.body
which interferes with Quickstarts by overlaying them.
This patch anchors the modal to the main element outside
of the Quickstart so that both can be visible at the same time.

Signed-off-by: Pavel Odvody <pavel@redhat.com>
This commit is contained in:
Pavel Odvody 2023-04-17 16:15:40 +02:00 committed by Lucas Garfield
parent 8fced39451
commit 466f158374

View file

@ -1,4 +1,4 @@
import React, { useEffect } from 'react';
import React, { useEffect, useMemo } from 'react';
import componentTypes from '@data-driven-forms/react-form-renderer/component-types';
import { addNotification } from '@redhat-cloud-services/frontend-components-notifications/redux';
@ -544,6 +544,11 @@ const CreateImageWizard = () => {
const handleClose = () => navigate(resolveRelPath(''));
const appendTo = useMemo(
() => document.querySelector('.pf-c-page.chr-c-page'),
[]
);
useEffect(() => {
if (isBeta()) {
dispatch(fetchRepositories());
@ -610,6 +615,9 @@ const CreateImageWizard = () => {
{
component: componentTypes.WIZARD,
name: 'image-builder-wizard',
ModalProps: {
appendTo,
},
className: 'imageBuilder',
isDynamic: true,
inModal: true,