-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Description
Describe the bug
When a modal is shown, it uses a transition, however at the moment isShow
is set in onAfterEnter
which doesn't happen until the end of the transition. This means you get sequential transitions or a perceived delay, also the buttons which should show disabled during the transition are always enabled.
Steps to reproduce the bug
- Extend the transition time of
fade
to make it easier to see - Trigger open of a modal
- You will see the backdrop fade in
- Then after that the
show
class is added and you see the modal show transition
Expected behavior
The show
class needs to be added at the same point as a enter-to
class would be added, i.e. the very next frame after enter.
Versions
Libraries:
- BootstrapVue: 2.4.1
- Bootstrap: 4.4.1
- Vue: 2.6.10
Fix
To solve the issue I changed the following here:
bootstrap-vue/src/components/modal/modal.js
Line 616 in 7a34f73
onEnter() { |
onEnter() {
this.isBlock = true;
window.requestAnimationFrame(() => {
window.requestAnimationFrame(() => {
this.isShow = true;
});
});
}
And also remove this.isShow = true;
from onAfterEnter
Ideally I'd like to use nextFrame(() => {this.isShow = true;})
from the built in transition lib in Vue but I couldn't see a way to import that definition. https://github.com/vuejs/vue/blob/4de4649d9637262a9b007720b59f80ac72a5620c/src/platforms/web/runtime/transition-util.js#L67