Skip to content

Commit 9758dfd

Browse files
jacobmllr95tmorehouse
authored andcommitted
fix(modal): Show/Hide when once prevented (#2275)
1 parent cd41f3e commit 9758dfd

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/components/modal/modal.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -565,8 +565,9 @@ export default {
565565
relatedTarget: null
566566
})
567567
this.emitEvent(showEvt)
568+
// Don't show if canceled
568569
if (showEvt.defaultPrevented || this.is_visible) {
569-
// Don't show if canceled
570+
this.is_opening = false
570571
return
571572
}
572573
if (!this.noStacking) {
@@ -613,6 +614,7 @@ export default {
613614
this.emitEvent(hideEvt)
614615
// Hide if not canceled
615616
if (hideEvt.defaultPrevented || !this.is_visible) {
617+
this.is_closing = false
616618
return
617619
}
618620
// stop observing for content changes
@@ -862,12 +864,13 @@ export default {
862864
modal.style.paddingRight = ''
863865
}
864866
},
865-
checkScrollbar () {
867+
checkScrollbar () /* istanbul ignore next: getBCR can't be tested in JSDOM */{
866868
const { left, right, height } = getBCR(document.body)
867869
// Extra check for body.height needed for stacked modals
868870
this.isBodyOverflowing = (left + right) < window.innerWidth || height > window.innerHeight
869871
},
870872
setScrollbar () {
873+
/* istanbul ignore if: get Computed Style can't be tested in JSDOM */
871874
if (this.isBodyOverflowing) {
872875
// Note: DOMNode.style.paddingRight returns the actual value or '' if not set
873876
// while $(DOMNode).css('padding-right') returns the calculated value or 0 if not set
@@ -959,6 +962,8 @@ export default {
959962
this._observer.disconnect()
960963
this._observer = null
961964
}
965+
// Ensure our root "once" listener is gone
966+
this.$root.$off('bv::modal::hidden', this.doShow)
962967
this.setEnforceFocus(false)
963968
this.setResizeEvent(false)
964969
if (this.is_visible) {

0 commit comments

Comments
 (0)