question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

feat(modal): Close all modals at once (do it in the same way as popover does)

See original GitHub issue

About Modals from the doc:

You can emit … bv::hide::modal event on $root with the first argument set to the modal’s id.

Example:

this.$root.$emit(‘bv::hide::modal’,‘modal1’)


About Popover from the doc:

You can close (hide) all open popovers by emitting the bv::hide::popover event on $root

Example:

this.$root.$emit(‘bv::hide::popover’)


So the feature request is to add ability to use just this.$root.$emit('bv::hide::modal') (i.e. without modal’s id) in order to close all modals.

This feature will be useful regarding this PR#2164.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
akhourycommented, Nov 13, 2021

@TitanFighter a bit late to the party, but i ran into this today and wanted to close all modals no matter what when the route is changed…

Array.from(window.document.querySelectorAll('.modal.show'))
    .map(el => el.id)
    .forEach((id) => {
        this.$root.$emit('bv::hide::modal', id)
    })

assuming they have an id

0reactions
jacobmllr95commented, Apr 9, 2019

The <b-modal> logic is already too complex to allow this kind of feature.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to close all active bootstrap modals on session timeout?
Use the following code: $('.modal').modal('hide');. Also if you would like to do something if the modal is hidden then you can do this:...
Read more >
Modal · Bootstrap
Modals are built with HTML, CSS, and JavaScript. · Clicking on the modal “backdrop” will automatically close the modal. · Bootstrap only supports...
Read more >
Prevent Page Scrolling When a Modal is Open
You open a modal, scroll through it, close it, and wind up somewhere else on the page than you were when you opened...
Read more >
How to handle multiple modals in React
Most applications have plenty of modals also sometimes referred to as popover, dialogs or popups. The most obvious way of displaying a modal...
Read more >
Fancy Form Modals with Rails + Turbo
Gives us the ability to close the modal. This is triggered by clicking on the dedicated close button, or clicking anywhere outside the...
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