Topic: Modal Non-Invasive + Vertically Centered

Andrew Ford priority asked 3 days ago


I have a modal with the data-mdb-modal-non-invasive="true".

I realized this specific modal would look better if I added the class .modal-dialog-centered.

Problem:

The non-invasive attribute and the .modal-dialog-centered class don't work together. The modal snaps back to the default top frame.

<div class="modal fade" id="quickAskModal" role="dialog" tabindex="-1" data-mdb-modal-non-invasive="true" aria-labelledby="quickAskLabel" aria-hidden="true">
  <div class="modal-dialog modal-dialog-centered modal-sm">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title" id="quickAskLabel">Ask the User a Question</h5>
        <button type="button" class="btn-close" data-mdb-dismiss="modal" aria-label="Close"></button>
      </div>
      <div class="modal-body">
        <form id="quickAskForm">
          <div class="row">
            <div class="col-12">
              <div class="form-outline" data-mdb-input-init>
                <textarea class="form-control" id="quickAskInput" name="quickAskInput" rows="3"></textarea>
                <label for="quickAskInput" class="form-label">Your Question</label>
              </div>
            </div>
          </div>
        </form>
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-dark btn-sm" data-mdb-ripple-init data-mdb-dismiss="modal">Close</button>
        <button type="button" class="btn btn-orange btn-sm" id="quickAskBtn" data-userid="${userId}">Ask!</button>
      </div>
    </div>
  </div>
</div>

Ideally, I would like to see the modal remain centered while I enable the non-invasive feature.


Kamila Pieńkowska staff answered 8 hours ago


No, it was never introduced as an option, as the use case is very rare. A non-invasive modal does not block interaction with the page, so it is rarely placed in the center since it is supposed to be unobtrusive.

You may consider using a normal modal and disabling the backdrop as an alternative with: data-mdb-backdrop="false".



Modal non-invasive is positioned dynamically and it does not work with .modal-dialog-centered as of now.


Andrew Ford priority commented 1 day ago

I'm aware that they didn't work after I tested them.

Can you get these two features to work with each other?



Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Answered

Specification of the issue

  • ForumUser: Priority
  • Premium support: Yes
  • Technology: MDB Standard
  • MDB Version: MDB5 8.2.0
  • Device: N/A
  • Browser: N/A
  • OS: N/A
  • Provided sample code: Yes
  • Provided link: No