How to make a modal appear over the webpart not within it?

Pipkin, Thomas 21 Reputation points
2020-10-12T11:33:22.607+00:00

I'm creating SharePoint webparts using SPFX and have noticed that the modal doesn't open up on top of the web part but within it. If this is by design, then how would I make the initial webpart (with no modal opened) encompass the entire SharePoint page, subsequently allowing the modal to fit with no size restrictions?

Here is the modal I'm using and the CSS for the initial webpart:

.panelMeetTab {
  .container {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    max-width: 100%;
    margin: 0px auto;
    box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.2), 0 25px 50px 0 rgba(0, 0, 0, 0.1);
  }

}
  .modalBody {
    height: 1300px;
    width: 1800px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding-left: 15px;
    padding-top: 15px;
    padding-right: 2px;
    overflow: clip;
  }

And here is the modal in the JSX:

<Modal
  titleAriaId={this._titleId}
  subtitleAriaId={this._subtitleId}
  isOpen={this.state.showModal}
  onDismiss={this._closeModal}
  closeButtonAriaLabel={"Close"}
  isBlocking={true}
  containerClassName={styles.modalBody}
  >

This modal is within the <div> of the web part.

Microsoft 365 and Office | SharePoint Server | Development
{count} votes

Accepted answer
  1. Baker Kong-MSFT 3,801 Reputation points
    2020-10-13T08:34:07.677+00:00

    Hi @Pipkin, Thomas ,

    Are you using Fluent UI modal react component?

    I tested your code on my SPO page, I think the component works as the doc described.

    31936-test.gif

    Below is my test demo, you may have a look:

    Best Regards,
    Baker Kong


    If an Answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.