Skip to content

Commit 332b79f

Browse files
authored
fix(modal): fix scroll to top issue when modal has no-fade set (#4004)
1 parent 3aa78fd commit 332b79f

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/components/modal/modal.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -775,11 +775,14 @@ export const BModal = /*#__PURE__*/ Vue.extend({
775775
: autoFocus === 'close' && close
776776
? close.$el || close
777777
: content
778-
// Make sure top of modal is showing (if longer than the viewport)
778+
// Focus the element
779+
attemptFocus(el)
779780
if (el === content) {
780-
modal.scrollTop = 0
781+
// Make sure top of modal is showing (if longer than the viewport)
782+
this.$nextTick(() => {
783+
modal.scrollTop = 0
784+
})
781785
}
782-
attemptFocus(el)
783786
}
784787
})
785788
}

0 commit comments

Comments
 (0)