i have funny problem in bootstrap 5.0.2
I have to double-click the button (data-bs-dismiss) to close the modal
Important note:I use many modal in page, But they open depending on the need
<div class="modal" id="open-rating-modal-for-order" tabindex="-1" aria-labelledby="open-call-modal" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<form method='POST' onsubmit="return validate_rating_modal()">
<input type='hidden' name='page' value='submit-rate' />
<input type='hidden' name='csrf_token' value="{$csrf_token}" />
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">
rates
</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
</div>
</div>
</div>
I just applied the fade
class style to the first container and added a <button>
element to trigger the modal to pop up and it worked successfully.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<title>Document</title>
</head>
<body>
<div class="d-grid gap-2">
<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#open-rating-modal-for-order">
Open Modal
</button>
</div>
<div class="modal fade" id="open-rating-modal-for-order" tabindex="-1" aria-labelledby="open-call-modal"
aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<form method='POST' onsubmit="return validate_rating_modal()">
<input type='hidden' name='page' value='submit-rate' />
<input type='hidden' name='csrf_token' value="{$csrf_token}" />
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">
Rates
</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal"></button>
</div>
</form>
</div>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" crossorigin="anonymous">
</script>
</body>
</html>