Using summernote inside Nested Bootstrap modal dialogs and solving the problem of tooltips and popovers

See original GitHub issue

I had the problems of using summernote inside dynamic generated bootstrap modal dialog and show its tooltips and popover. I solved it using the following steps for anyone interested in those issues:

First Make sure you specify dialogsInBody: true when create a summernote instance.

Second To support nested multi bootstrap modal dialogs used in summernote and to support showing tooltips and popover register the following event handlers in a global location:

$(document).on("show.bs.modal", '.modal', function (event) {
    console.log("Global show.bs.modal fire");
    var zIndex = 100000 + (10 * $(".modal:visible").length);
    $(this).css("z-index", zIndex);
    setTimeout(function () {
        $(".modal-backdrop").not(".modal-stack").first().css("z-index", zIndex - 1).addClass("modal-stack");
    }, 0);
}).on("hidden.bs.modal", '.modal', function (event) {
    console.log("Global hidden.bs.modal fire");
    $(".modal:visible").length && $("body").addClass("modal-open");
});
$(document).on('inserted.bs.tooltip', function (event) {
    console.log("Global show.bs.tooltip fire");
    var zIndex = 100000 + (10 * $(".modal:visible").length);
    var tooltipId = $(event.target).attr("aria-describedby");
    $("#" + tooltipId).css("z-index", zIndex);
});
$(document).on('inserted.bs.popover', function (event) {
    console.log("Global inserted.bs.popover fire");
    var zIndex = 100000 + (10 * $(".modal:visible").length);
    var popoverId = $(event.target).attr("aria-describedby");
    $("#" + popoverId).css("z-index", zIndex);
});

The previous code will support nested bootstrap modals dialogs and tooltips and popover. the following images show the results:

1

2

3

if you have any suggestions or notes kindly share them with me

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:31
  • Comments:9 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
MaximVanhovecommented, Apr 20, 2018

Thank you @mdarim

1reaction
DiemenDesigncommented, Jan 13, 2018

Apart from the dialogsInBody option, it looks as though this is more of a Bootstrap issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Summernote Modals locked within pure Bootstrap modals
I have a normal modal with a summernote element within it, nothing special whatsoever. When I use summernote features, if I use summernote...
Read more >
JavaScript · Bootstrap
Modals are streamlined, but flexible, dialog prompts with the minimum required ... For performance reasons, the Tooltip and Popover data-apis are opt-in, ...
Read more >
summernote | Yarn - Package Manager
Summernote is a JavaScript library that helps you create WYSIWYG editors online. ... This is a hotfix for fixing path problem on css...
Read more >
Tooltip, Popover, and Modal - Kaizen Design System
Popovers : A popover displays rich content in a non-modal dialog to describe or add additional information when users hover over, focus on, ......
Read more >
[Best solution]-Bootstrap 4 grid issue only on Safari
Featured post · Change bootstrap navbar default background color · wordpress post excerpt in bootstrap popover · Searchbox goes under the hamburger menu...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found