When a visitor clicks on the area outside the Modal dialog, it also closes

I am running into a problem creating a Modal Dialog. I found that by default there is a button with a cross to close the dialog, which works fine. However, when a visitor clicks on the area outside the dialog, it also closes, which is not intended. The dialogue should only close when the cross is pressed. I can’t find anything about this in Bootstrap Studio. I also want the area under the dialog to become semi-transparent with a gray color, but this setting also doesn’t seem possible in the software. At least I couldn’t find it. Can you help me with this? Thanks in advance.

Cheers

Hello, add a data-bs-backdrop=“static” attribute in the row that contains the “modal” class.

Thank you that did the trick great!!

Here a working script sample:

<!DOCTYPE html>
<html data-bs-theme="light" lang="en">

    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no">
        <title>Raimondo</title>
        <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css">
    </head>

    <body>
        <div class="modal fade" data-bs-backdrop="static" role="dialog" tabindex="-1" id="myModal">
            <div class="modal-dialog" role="document">
                <div class="modal-content">
                    <div class="modal-header">
                        <h4 class="modal-title">Modal Title</h4><button class="btn-close" type="button" aria-label="Close" data-bs-dismiss="modal"></button>
                    </div>
                    <div class="modal-body">
                        <p>The content of your modal.</p>
                    </div>
                    <div class="modal-footer"><button class="btn btn-light" type="button" data-bs-dismiss="modal">Close</button><button class="btn btn-primary" type="button">Save</button></div>
                </div>
            </div>
        </div>
        <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
        <script src="assets/js/scripts.js"></script>
        <script>
            openModalDialog();
        </script>
    </body>

</html>

scripts.js:

function openModalDialog()
{
    var modalElement = document.getElementById("myModal");
    var modal = new bootstrap.Modal(modalElement);
    modal.show();
}

Cheers!!!