From 8903d8e4b697ee2822131f616e615cd5c16bbdf7 Mon Sep 17 00:00:00 2001 From: Troy Morehouse Date: Tue, 3 Sep 2019 12:21:26 -0300 Subject: [PATCH] fix(modal): fix scroll to top issue when modal has `no-fade` set --- src/components/modal/modal.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/components/modal/modal.js b/src/components/modal/modal.js index f002a33431d..d1ff2bc0be5 100644 --- a/src/components/modal/modal.js +++ b/src/components/modal/modal.js @@ -775,11 +775,14 @@ export const BModal = /*#__PURE__*/ Vue.extend({ : autoFocus === 'close' && close ? close.$el || close : content - // Make sure top of modal is showing (if longer than the viewport) + // Focus the element + attemptFocus(el) if (el === content) { - modal.scrollTop = 0 + // Make sure top of modal is showing (if longer than the viewport) + this.$nextTick(() => { + modal.scrollTop = 0 + }) } - attemptFocus(el) } }) }