[b-alert] Dismissible alerts cannot be resused
See original GitHub issueSo I’m trying so use a single alert component in a parent vue component. Children pass up messages, and the parent resets the content and show
value on the alert. I can’t get the alert to re-show because the show
value in the parent isn’t updated when using the countdown. I try updating the show value with the dismiss countdown event, but that doesn’t work after I dismiss an alert.
https://jsfiddle.net/alexsasharegan/zrdur2cp/
- Try dropping a msg into the input, letting it self-dismiss. All good.
- Now try the other btn. Should be good.
- Now fire a btn and dismiss. Should close.
- Now fire another btn. DOA
Issue Analytics
- State:
- Created 6 years ago
- Comments:11 (10 by maintainers)
Top Results From Across the Web
Twitter Bootstrap alert message close and open again
Data-dismiss completely removes the element. Use jQuery's .hide() method instead. The fix-it-quick method: Using inline javascript to hide the element ...
Read more >Alerts - Bootstrap
Using the alert JavaScript plugin, it's possible to dismiss any alert inline. Here's how: Be sure you've loaded the alert plugin, or the...
Read more >Alerts · Bootstrap
Over a dozen reusable components built to provide buttons, dropdowns, input groups, navigation, ... For inline dismissal, use the alerts jQuery plugin.
Read more >React Hooks + Bootstrap - Alert Notifications - Jason Watmore's
This tutorial shows how to implement a simple reusable alert component using React Hooks, Bootstrap CSS and RxJS.
Read more >Bootstrap Alert Guide: Learn About Bootstrap Error Message
Using Bootstrap alerts, you can make predefined messages to appear in ... that can be closed, you need to use the .alert-dismissable class....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Able to replicate this on the main documentation page using Chrome
https://bootstrap-vue.js.org/docs/components/alert/
Steps to replicate easily 1.) Click on the “Show alert with count-down timer” button 2.) Click the X mark quickly (less than a second after clicking the button above) 3.) Clicking the button again will not display the alert anymore.
This has something to do with the timing with the dismiss countdown timer.
PR’s #897 (0.x dev branch) and #898 (1.x branch) should address this.
The main root cause was actually the demo not listening to
@dismissed
and resetting thedismissCountDown
value to 0.What was happening is that
dismissCountDown
didn’t change whendimissed
was called before the first second elapsed, So thedismissCountDown
var still had a value that was the same as it was originally (the initial countdown value). So trying to setshow
to this value again never triggered theshow
watcher.But these PRs also will emit a dismiss countdown event with value of 0 when dismissed is called as well, as a just in case.
I’ve re-enabled the dismiss button on auto-dismissing alerts.