I'm facing an issue with a Bootstrap 4 modal that contains buttons, one of which is supposed to trigger a custom popover div centered below it. The popover works fine outside the modal, but within the modal, it's partially hidden.
After trying various styles like overflow:
and z-index:
, I still can't get the popover to display fully in its current position relative to the "Button 1" button.
How can I ensure the popover is completely visible under the "Button 1" button despite being in the modal?
<link href="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="c2a0adadb6b1b6b0a3b282f6ecf4ecf0">[email protected]</a>/dist/css/bootstrap.min.css" rel="stylesheet"/>
<div class="modal" tabindex="-1" data-backdrop="static" data-keyboard="false" data-show="false" data-focus="true" style="display: block;">
<div class="modal-dialog">
<div class="modal-content">
<!-- Modal Header -->
<div class="modal-header" style="margin-bottom: 0px; padding: 0.5rem 1rem; border-bottom: 0px; background-color: rgb(248, 249, 252);">
<h5 class="modal-title text-center">
Title Here
</h5>
<button type="button" class="close"><span aria-hidden="true">×</span></button>
</div>
<!-- Modal Body -->
<div class="modal-body" style="padding: 0px; max-height: 80vh; overflow: auto;">
<div class="card card-body" style="padding: 0.5em; border: 0px; margin: 0px; overflow: hidden;">
<div style="margin: 0.5em; padding: 0px;">
Lorem ipsum dolor sit amet consectetur adipiscing elit nec montes eleifend
</div>
<hr style="margin-bottom: 3px; margin-top: 3px;" />
<!-- Modal Buttons -->
<div class="row">
<div class="col-6 text-center">
<button class="btn btn-sm text-muted user-comm-react-btn">Button 1</button>
<!-- Button 1 Popover Div -->
<div class="text-center bg-light shadow" style="position: absolute; width: fit-content; margin: 0px auto; border-radius: 2em; left: 50%; transform: translateX(-50%); z-index: 999; white-space: nowrap; border: 1px solid rgb(227, 230, 240);">
Lorem ipsum dolor sit amet consectetur adipiscing elit nec montes eleifend
</div>
</div>
<div class="col-6 text-center">
<button class="btn btn-sm text-muted">Button 2</button>
</div>
</div>
<hr style="margin-bottom: 3px; margin-top: 3px;" />
</div>
</div>
<!-- Modal Footer -->
<div class="modal-footer" style="padding: 0.25em; border-top: medium;z-index: 4;">
Lorem ipsum dolor sit amet consectetur adipiscing elit nec montes eleifend
</div>
</div>
</div>
</div>