After update to 8.x-3.15 (after reading release noted, I suspect the issue occurs at the 8.x-3.14 release)

When using native Bootstrap modals within the TWIG page.html.twig markup, modals no longer are able to be triggered via Bootstrap's Javascript modal('show') method for users that are logged in with the Drupal admin toolbar present. They are however able to be triggered via a link with the "data-toggle="modal" data-target="#modal"" method.

I have found that if I disable the option for "Enable Bootstrap Modals" under my less Bootstrap subtheme, the modal('show') method works again.

To replicate, add a modal to the page:

<div id="modal-search" class="modal fade modal-fullscreen" tabindex="-1" role="dialog" aria-label="Search">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-body">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close">x</button>
        Modal content here...
      </div>
    </div>
  </div>
</div>

And attempt to trigger via Javascript (while logged in as a user with access to the admin toolbar):

jQuery(window).on("load", function() {
  jQuery("#modal-search").modal('show');
})

My testing indicates that:

  • Modals are able to be triggered via modal('show') for anonymous users, or users that are authenticated without admin toolbar
  • Modals are able to be triggered via modal('show') when Enable Bootstrap Modals option is disabled in sub-theme settings
CommentFileSizeAuthor
#2 3016697-2.patch1.32 KBmarkhalliwell
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

nrusse02 created an issue. See original summary.

markhalliwell’s picture

Title: modal('show') method no longer working for users with admin toolbar after update » The "show" and "toggle" methods for modals no longer initializes
Status: Active » Fixed
FileSize
1.32 KB

  • markcarver committed 868c537 on 8.x-3.x
    Issue #3016697 by markcarver, nrusse02: The "show" and "toggle" methods...
nrusse02’s picture

Thank you, Mark!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.