Fa'ase'e ile anotusi autu Fa'ase'e ile su'ega fa'amatalaga

Fa'aoga le Bootstrap's JavaScript modal plugin e fa'aopoopo ai fa'atalanoaga i lau 'upega tafa'ilagi mo pusa moli, fa'amatalaga a tagata fa'aoga, po'o mea fa'aaganu'u atoatoa.

E faapefea ona galue

Aʻo leʻi amataina le vaega faʻapitoa a Bootstrap, ia mautinoa e faitau mea nei ona ua suia talu ai nei a matou lisi lisi.

  • O faʻataʻitaʻiga e fausia i le HTML, CSS, ma le JavaScript. O lo'o fa'atulagaina i luga o isi mea uma i totonu o le pepa ma aveese le ta'ai mai le <body>fa'asolo ina ia mafai ai ona fa'asolo mea fa'apitoa.
  • O le kiliki i luga o le modal "backdrop" o le a otometi lava ona tapunia le modal.
  • E na'o le tasi le fa'amalama fa'ata'ita'i e lagolagoina e Bootstrap i le taimi. E le lagolagoina auala fa'akomepiuta aua matou te talitonu o ni fa'amatalaga leaga a tagata fa'aoga.
  • Fa'aoga tupe position: fixed, lea e mafai i nisi taimi ona fa'apitoa i lona fa'aliliuga. So'o se taimi e mafai ai, tu'u lau HTML HTML i se tulaga maualuga e aloese ai mai fa'alavelave fa'alavelave mai isi elemene. E ono tula'i mai ni fa'afitauli pe a fa'amomoe se .modali totonu o se isi elemene mautu.
  • Toe tasi, ona o position: fixed, o loʻo i ai ni faʻamatalaga faʻatasi ma le faʻaogaina o auala i luga o masini feaveaʻi. Va'ai la matou su'esu'ega lagolago docs mo fa'amatalaga.
  • Ona o le auala e faʻamatalaina ai e le HTML5 ona faʻaoga, o le autofocusuiga HTML e leai se aoga i Bootstrap modals. Ina ia ausia le aafiaga tutusa, faʻaaoga nisi JavaScript masani:
var myModal = document.getElementById('myModal')
var myInput = document.getElementById('myInput')

myModal.addEventListener('shown.bs.modal', function () {
  myInput.focus()
})
O le aafiaga o le animation o lenei vaega e fa'alagolago i le su'esu'ega a le prefers-reduced-motionaufaasālalau. Va'ai le vaega fa'aitiitiga fa'aitiitiga oa matou pepa fa'aoga avanoa .

Faitau pea mo faʻataʻitaʻiga ma taʻiala faʻaoga.

Faataitaiga

O loʻo i lalo se faʻataʻitaʻiga faʻataʻitaʻiga masani (o lona uiga o lona positionma displayua faʻamalo). O lo'o aofia ai le fa'auluuluga fa'apena, tino fa'apitoa (mana'omia mo padding), ma le fa'avae fa'ailoga (filifiliga). Matou te talosaga atu ia e fa'aofia fa'aulutala fa'apena ma fa'ate'a gaioiga i so'o se taimi e mafai ai, po'o le tu'uina atu o se isi gaioiga fa'ate'a manino.

<div class="modal" tabindex="-1">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title">Modal title</h5>
        <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
      </div>
      <div class="modal-body">
        <p>Modal body text goes here.</p>
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
        <button type="button" class="btn btn-primary">Save changes</button>
      </div>
    </div>
  </div>
</div>

Live demo

Su'e se fa'ata'ita'iga fa'atino galue i le kilikiina o le ki lalo. O le a fa'ase'e ifo i lalo ma mou atu mai le pito i luga o le itulau.

<!-- Button trigger modal -->
<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#exampleModal">
  Launch demo modal
</button>

<!-- Modal -->
<div class="modal fade" id="exampleModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title" id="exampleModalLabel">Modal title</h5>
        <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
      </div>
      <div class="modal-body">
        ...
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
        <button type="button" class="btn btn-primary">Save changes</button>
      </div>
    </div>
  </div>
</div>

Fa'aola fa'atete'e

A tu'u le tua i le tulaga, e le tapunia le modal pe a kiliki i fafo. Kiliki le ki lalo e taumafai ai.

<!-- Button trigger modal -->
<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#staticBackdrop">
  Launch static backdrop modal
</button>

<!-- Modal -->
<div class="modal fade" id="staticBackdrop" data-bs-backdrop="static" data-bs-keyboard="false" tabindex="-1" aria-labelledby="staticBackdropLabel" aria-hidden="true">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title" id="staticBackdropLabel">Modal title</h5>
        <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
      </div>
      <div class="modal-body">
        ...
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
        <button type="button" class="btn btn-primary">Understood</button>
      </div>
    </div>
  </div>
</div>

Ta'avale anotusi umi

A o'o ina umi tele auala mo le va'aiga a le tagata fa'aoga po'o le masini, latou te ta'avale tuto'atasi mai le itulau lava ia. Taumafai le faʻataʻitaʻiga o loʻo i lalo e iloa ai le matou uiga.

E mafai foʻi ona e fatuina se taʻavale faʻapipiʻi lea e mafai ai ona taʻavale le tino modal e ala i le faʻaopoopo .modal-dialog-scrollablei le .modal-dialog.

<!-- Scrollable modal -->
<div class="modal-dialog modal-dialog-scrollable">
  ...
</div>

Tutotonu i luga

Fa'aopoopo .modal-dialog-centeredi .modal-dialogle fa'atūtonu i le ogatotonu le modal.

<!-- Vertically centered modal -->
<div class="modal-dialog modal-dialog-centered">
  ...
</div>

<!-- Vertically centered scrollable modal -->
<div class="modal-dialog modal-dialog-centered modal-dialog-scrollable">
  ...
</div>

Tooltips ma popovers

Tooltips ma popovers e mafai ona tuʻuina i totonu o auala pe a manaʻomia. A tapunia auala, so'o se meafaigaluega ma popovers i totonu e otometi lava ona fa'ate'aina.

<div class="modal-body">
  <h5>Popover in a modal</h5>
  <p>This <a href="#" role="button" class="btn btn-secondary popover-test" title="Popover title" data-bs-content="Popover body content is set in this attribute.">button</a> triggers a popover on click.</p>
  <hr>
  <h5>Tooltips in a modal</h5>
  <p><a href="#" class="tooltip-test" title="Tooltip">This link</a> and <a href="#" class="tooltip-test" title="Tooltip">that link</a> have tooltips on hover.</p>
</div>

Fa'aaogaina o le fa'asologa

Fa'aaogā le faiga fa'asologa o Bootstrap i totonu o se fa'ata'ita'iga e ala i le fa'aputu .container-fluidi totonu o le .modal-body. Ona fa'aaoga lea o vasega masani fa'asologa o faiga e pei ona e faia i se isi lava mea.

<div class="modal-body">
  <div class="container-fluid">
    <div class="row">
      <div class="col-md-4">.col-md-4</div>
      <div class="col-md-4 ms-auto">.col-md-4 .ms-auto</div>
    </div>
    <div class="row">
      <div class="col-md-3 ms-auto">.col-md-3 .ms-auto</div>
      <div class="col-md-2 ms-auto">.col-md-2 .ms-auto</div>
    </div>
    <div class="row">
      <div class="col-md-6 ms-auto">.col-md-6 .ms-auto</div>
    </div>
    <div class="row">
      <div class="col-sm-9">
        Level 1: .col-sm-9
        <div class="row">
          <div class="col-8 col-sm-6">
            Level 2: .col-8 .col-sm-6
          </div>
          <div class="col-4 col-sm-6">
            Level 2: .col-4 .col-sm-6
          </div>
        </div>
      </div>
    </div>
  </div>
</div>

Feeseesea'iga tulaga fa'aoga

E i ai ni fa'amau fa'amau e fa'aoso uma le faiga tutusa ma ni mea e ese'ese teisi? Fa'aoga event.relatedTargetma uiga HTMLdata-bs-* e fesuia'i ai mea o lo'o i totonu o le fa'ata'atia e fa'atatau i le fa'amau na kiliki.

O loʻo i lalo se faʻataʻitaʻiga ola ma faʻataʻitaʻiga HTML ma JavaScript. Mo nisi fa'amatalaga, faitau le modal events docs mo fa'amatalaga ile relatedTarget.

<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#exampleModal" data-bs-whatever="@mdo">Open modal for @mdo</button>
<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#exampleModal" data-bs-whatever="@fat">Open modal for @fat</button>
<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#exampleModal" data-bs-whatever="@getbootstrap">Open modal for @getbootstrap</button>

<div class="modal fade" id="exampleModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title" id="exampleModalLabel">New message</h5>
        <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
      </div>
      <div class="modal-body">
        <form>
          <div class="mb-3">
            <label for="recipient-name" class="col-form-label">Recipient:</label>
            <input type="text" class="form-control" id="recipient-name">
          </div>
          <div class="mb-3">
            <label for="message-text" class="col-form-label">Message:</label>
            <textarea class="form-control" id="message-text"></textarea>
          </div>
        </form>
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
        <button type="button" class="btn btn-primary">Send message</button>
      </div>
    </div>
  </div>
</div>
var exampleModal = document.getElementById('exampleModal')
exampleModal.addEventListener('show.bs.modal', function (event) {
  // Button that triggered the modal
  var button = event.relatedTarget
  // Extract info from data-bs-* attributes
  var recipient = button.getAttribute('data-bs-whatever')
  // If necessary, you could initiate an AJAX request here
  // and then do the updating in a callback.
  //
  // Update the modal's content.
  var modalTitle = exampleModal.querySelector('.modal-title')
  var modalBodyInput = exampleModal.querySelector('.modal-body input')

  modalTitle.textContent = 'New message to ' + recipient
  modalBodyInput.value = recipient
})

Fa'asolo i le va o auala

Fa'asolo i le va o le tele o auala faʻatasi ma se faʻaogaina poto o le data-bs-targetma data-bs-toggleuiga. Mo se fa'ata'ita'iga, e mafai ona e fesuia'i se fa'aupuga e toe setiina ai upu fa'aupuga mai totonu o se fa'ailoga ua matala ile fa'ailoga. Faamolemole ia matau le tele o auala e le mafai ona tatalaina i le taimi e tasi -o lenei metotia e na o le fesuiaʻi i le va o auala eseese e lua.

Tatala le auala muamua
<div class="modal fade" id="exampleModalToggle" aria-hidden="true" aria-labelledby="exampleModalToggleLabel" tabindex="-1">
  <div class="modal-dialog modal-dialog-centered">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title" id="exampleModalToggleLabel">Modal 1</h5>
        <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
      </div>
      <div class="modal-body">
        Show a second modal and hide this one with the button below.
      </div>
      <div class="modal-footer">
        <button class="btn btn-primary" data-bs-target="#exampleModalToggle2" data-bs-toggle="modal" data-bs-dismiss="modal">Open second modal</button>
      </div>
    </div>
  </div>
</div>
<div class="modal fade" id="exampleModalToggle2" aria-hidden="true" aria-labelledby="exampleModalToggleLabel2" tabindex="-1">
  <div class="modal-dialog modal-dialog-centered">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title" id="exampleModalToggleLabel2">Modal 2</h5>
        <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
      </div>
      <div class="modal-body">
        Hide this modal and show the first with the button below.
      </div>
      <div class="modal-footer">
        <button class="btn btn-primary" data-bs-target="#exampleModalToggle" data-bs-toggle="modal" data-bs-dismiss="modal">Back to first</button>
      </div>
    </div>
  </div>
</div>
<a class="btn btn-primary" data-bs-toggle="modal" href="#exampleModalToggle" role="button">Open first modal</a>

Suia le animation

O le $modal-fade-transformfesuiaiga e fuafua ai le suiga o le tulaga .modal-dialogaʻo leʻi oʻo i le modal fade-in animation, o le $modal-show-transformfesuiaiga e fuafua le suiga o .modal-dialogle i le pito o le modal fade-in animation.

Afai e te manaʻo mo se faʻataʻitaʻiga se faʻaoso-i totonu animation, e mafai ona e seti $modal-fade-transform: scale(.8).

Aveese le animation

Mo auala e foliga mai nai lo le mou atu e matamata ai, aveese le .fadevasega mai lau faʻailoga faʻailoga.

<div class="modal" tabindex="-1" aria-labelledby="..." aria-hidden="true">
  ...
</div>

Maualuluga malosi

Afai e suia le maualuga o se auala a'o tatala, e tatau ona e vala'au myModal.handleUpdate()e toe fetu'una'i le tulaga o le modal pe a aliali mai se ta'avale.

Avanoa

Ia mautinoa e faʻaopoopo aria-labelledby="...", faʻasino le ulutala modal, i .modal. E le gata i lea, e mafai ona e tuʻuina atu se faʻamatalaga o lau faʻasalalauga faʻatasi ma aria-describedbyon .modal. Manatua e te le mana'omia le fa'aopoopo role="dialog"talu ai ua uma ona matou fa'aopoopoina e ala i le JavaScript.

Fa'apipi'i ata YouTube

O le fa'apipi'iina o vitio YouTube i fa'aola e mana'omia ai le JavaScript fa'aopoopo ae le o le Bootstrap e otometi ai ona taofi le toe ta'alo ma sili atu. Va'ai lenei pou fesoasoani Stack Overflow mo nisi fa'amatalaga.

Fa'ailoga tetele

E tolu lapopo'a fa'apitoa, e maua e ala i vasega suiga e tu'u i luga o se .modal-dialog. O nei lapopo'a e a'a i totonu i nisi o va'a e alofia ai fa'alava ta'ai i luga o va'aiga vaapiapi.

Tele Vasega Modal max-lautele
Laiti .modal-sm 300px
Fa'atonu Leai 500px
Tele .modal-lg 800px
Tele tele .modal-xl 1140px

O la matou fa'aoga fa'aletonu e aunoa ma le fa'avasegaina o le vasega o lo'o fa'atūina ai le fa'asologa o le lapopoa "medium".

<div class="modal-dialog modal-xl">...</div>
<div class="modal-dialog modal-lg">...</div>
<div class="modal-dialog modal-sm">...</div>

Fa'ata'otoga ata

O le isi fa'aletonu o le filifiliga lea e fa'apipi'i ai se fa'atagata e ufiufi ai le va'aiga a le tagata fa'aoga, e maua e ala i vasega fa'aopoopo e tu'u i luga o se .modal-dialog.

Vasega Avanoa
.modal-fullscreen I taimi uma
.modal-fullscreen-sm-down Lalo576px
.modal-fullscreen-md-down Lalo768px
.modal-fullscreen-lg-down Lalo992px
.modal-fullscreen-xl-down Lalo1200px
.modal-fullscreen-xxl-down Lalo1400px
<!-- Full screen modal -->
<div class="modal-dialog modal-fullscreen-sm-down">
  ...
</div>

Sass

Fuafuaga

$modal-inner-padding:               $spacer;

$modal-footer-margin-between:       .5rem;

$modal-dialog-margin:               .5rem;
$modal-dialog-margin-y-sm-up:       1.75rem;

$modal-title-line-height:           $line-height-base;

$modal-content-color:               null;
$modal-content-bg:                  $white;
$modal-content-border-color:        rgba($black, .2);
$modal-content-border-width:        $border-width;
$modal-content-border-radius:       $border-radius-lg;
$modal-content-inner-border-radius: subtract($modal-content-border-radius, $modal-content-border-width);
$modal-content-box-shadow-xs:       $box-shadow-sm;
$modal-content-box-shadow-sm-up:    $box-shadow;

$modal-backdrop-bg:                 $black;
$modal-backdrop-opacity:            .5;
$modal-header-border-color:         $border-color;
$modal-footer-border-color:         $modal-header-border-color;
$modal-header-border-width:         $modal-content-border-width;
$modal-footer-border-width:         $modal-header-border-width;
$modal-header-padding-y:            $modal-inner-padding;
$modal-header-padding-x:            $modal-inner-padding;
$modal-header-padding:              $modal-header-padding-y $modal-header-padding-x; // Keep this for backwards compatibility

$modal-sm:                          300px;
$modal-md:                          500px;
$modal-lg:                          800px;
$modal-xl:                          1140px;

$modal-fade-transform:              translate(0, -50px);
$modal-show-transform:              none;
$modal-transition:                  transform .3s ease-out;
$modal-scale-transform:             scale(1.02);

Ta'amilosaga

E fa'atupuina $breakpointsfa'afanua fa'afanua ma se matasele i scss/_modal.scss.

@each $breakpoint in map-keys($grid-breakpoints) {
  $infix: breakpoint-infix($breakpoint, $grid-breakpoints);
  $postfix: if($infix != "", $infix + "-down", "");

  @include media-breakpoint-down($breakpoint) {
    .modal-fullscreen#{$postfix} {
      width: 100vw;
      max-width: none;
      height: 100%;
      margin: 0;

      .modal-content {
        height: 100%;
        border: 0;
        @include border-radius(0);
      }

      .modal-header {
        @include border-radius(0);
      }

      .modal-body {
        overflow-y: auto;
      }

      .modal-footer {
        @include border-radius(0);
      }
    }
  }
}

Fa'aoga

O le modal plugin e fesuia'i au mea natia pe a mana'omia, e ala i fa'amatalaga uiga po'o le JavaScript. E fa'amalo ai fo'i le amio ta'avale fa'aletonu ma fa'atupuina se .modal-backdrope tu'uina atu ai se vaega kiliki mo le fa'ate'aina o fa'aaliga fa'aalia pe a kiliki i fafo atu o le auala.

E ala i fa'amaumauga uiga

Fa'agaoioia se faiga e aunoa ma le tusia o le JavaScript. Seti data-bs-toggle="modal"i luga o se elemene e pulea, pei o se faamau, faatasi ai ma se data-bs-target="#foo"po href="#foo"o le taulaʻi i se faiga faʻapitoa e fesuiaʻi.

<button type="button" data-bs-toggle="modal" data-bs-target="#myModal">Launch modal</button>

E ala i le JavaScript

Fausia se faiga faʻatasi ma se laina e tasi o le JavaScript:

var myModal = new bootstrap.Modal(document.getElementById('myModal'), options)

Filifiliga

O filifiliga e mafai ona pasia e ala i faʻamatalaga uiga poʻo le JavaScript. Mo fa'amatalaga uiga, fa'aopoopo le igoa filifiliga i le data-bs-, pei o le data-bs-backdrop="".

Igoa Ituaiga Fa'atonu Fa'amatalaga
backdrop boolean po'o le manoa'static' true E aofia ai se elemene fa'aola-backdrop. I le isi itu, fa'amaoti staticmo se fa'ata'atia e le tapuni ai le auala ile kiliki.
keyboard boolean true Tapuni le auala pe a oomi le ki sola
focus boolean true Tu'u le taula'i ile faiga pe a amatalia.

Metotia

Metotia ma suiga e le tutusa

O metotia API uma e le fetaui ma amata se suiga . Latou te toe fo'i atu i le tagata telefoni i le taimi lava e amata ai le suiga ae le'i uma . E le gata i lea, o le a le amanaʻiaina se auala e valaʻau ai i se vaega o suiga .

Va'ai la matou pepa JavaScript mo nisi fa'amatalaga .

Filifiliga pasi

Fa'agaoioia lau anotusi e fai ma fa'ata'ita'iga. Talia se filifiliga faitalia object.

var myModal = new bootstrap.Modal(document.getElementById('myModal'), {
  keyboard: false
})

fesuia'i

Su'e ma le lima se faiga. Toe fo'i i le tagata vala'au a'o le'i fa'aalia pe natia le modal (fa'atusa a'o le'i tupu le shown.bs.modalpo'o le hidden.bs.modalmea na tupu).

myModal.toggle()

fa'aali

Tatala ma le lima se auala. Toe fo'i atu i le tagata vala'au a'o le'i fa'aalia moni le modal (fa'atusa a'o le'i tupu le shown.bs.modalmea na tupu).

myModal.show()

E le gata i lea, e mafai ona e pasia se elemene DOM e avea o se finauga e mafai ona maua i mea faʻapitoa (e pei o le relatedTargetmeatotino).

var modalToggle = document.getElementById('toggleMyModal') // relatedTarget
myModal.show(modalToggle)

lalafi

Natia ma le lima se auala. Toe fo'i i le tagata vala'au a'o le'i natia moni le modal (fa'atusa a'o le'i tupu le hidden.bs.modalmea na tupu).

myModal.hide()

handleUpdate

Toe fetu'una'i ma le lima le tulaga o le auala pe a suia le maualuga o le auala a'o tatala (fa'apea pe a aliali mai se ta'avale).

myModal.handleUpdate()

lafoa'i

Fa'aleaga le faiga o se elemene. (Ave'ese fa'amaumauga o lo'o teuina ile elemene DOM)

myModal.dispose()

getInstance

Metotia static lea e mafai ai ona e maua le faʻataʻitaʻiga faʻataʻitaʻiga e fesoʻotaʻi ma se elemene DOM

var myModalEl = document.getElementById('myModal')
var modal = bootstrap.Modal.getInstance(myModalEl) // Returns a Bootstrap modal instance

getOrCreateInstance

Metotia static lea e mafai ai ona e maua le faʻataʻitaʻiga faʻataʻitaʻiga e fesoʻotaʻi ma se elemene DOM, poʻo le fatuina o se mea fou i le tulaga e leʻi amataina.

var myModalEl = document.querySelector('#myModal')
var modal = bootstrap.Modal.getOrCreateInstance(myModalEl) // Returns a Bootstrap modal instance

Mea na tutupu

O le vasega fa'apitoa a Bootstrap o lo'o fa'aalia ai ni nai mea na tutupu mo le fa'aogaina o galuega fa'atino. O mea faʻapitoa uma e faʻaumatia i le modal lava ia (ie i le <div class="modal">).

Ituaiga mea na tupu Fa'amatalaga
show.bs.modal E mu vave lenei mea pe a showvalaʻau le auala faʻataʻitaʻiga. Afai e mafua mai i se kiliki, o le elemene kiliki e avanoa e avea ma relatedTargetmeatotino o le mea na tupu.
shown.bs.modal O lenei mea na tupu e faʻamalo pe a faʻaalia le modal i le tagata faʻaoga (o le a faʻatali mo suiga CSS e maeʻa). Afai e mafua mai i se kiliki, o le elemene kiliki e avanoa e avea ma relatedTargetmeatotino o le mea na tupu.
hide.bs.modal O lenei mea na tupu e faʻamalo vave pe a hidevalaʻau le auala faʻataʻitaʻiga.
hidden.bs.modal O lenei mea e tupu pe a maeʻa ona natia le modal mai le tagata faʻaoga (o le a faʻatali mo suiga CSS e maeʻa).
hidePrevented.bs.modal O lenei mea e tupu pe a faʻaalia le modal, o lona tua staticma se kiliki i fafo atu o le modal poʻo se sosolo ki lomitusi e faia i le filifiliga keyboard pe data-bs-keyboardseti i le false.
var myModalEl = document.getElementById('myModal')
myModalEl.addEventListener('hidden.bs.modal', function (event) {
  // do something...
})