Ensure Launch wizard is anchored to proper element

By default modals are anchored to document.body which inteferes
with quickstarts

Signed-off-by: Pavel Odvody <pavel@redhat.com>
This commit is contained in:
Pavel Odvody 2023-04-18 11:59:09 +02:00 committed by Lucas Garfield
parent 466f158374
commit 45547c607b

View file

@ -1,4 +1,4 @@
import React, { Suspense, useState } from 'react';
import React, { Suspense, useState, useMemo } from 'react';
import { Button } from '@patternfly/react-core';
import useChrome from '@redhat-cloud-services/frontend-components/useChrome';
@ -38,6 +38,11 @@ const ProvisioningLink = ({ imageId, isExpired, isInClonesTable }) => {
{}
);
const appendTo = useMemo(
() => document.querySelector('.pf-c-page.chr-c-page'),
[]
);
const provider = getImageProvider(image);
if (!error) {
return (
@ -62,6 +67,7 @@ const ProvisioningLink = ({ imageId, isExpired, isInClonesTable }) => {
// https://github.com/RHEnVision/provisioning-frontend/pull/238
sourceId: image.share_with_sources?.[0],
}}
appendTo={appendTo}
/>
)}
</Suspense>