From ff6cab96cf1003527a602dd4b26f826ea90b8b99 Mon Sep 17 00:00:00 2001 From: Alexandre Paradis Date: Thu, 19 Dec 2019 15:29:24 -0500 Subject: [PATCH] Fix #2093 Focus on Modal when `isActive` is changed --- docs/pages/components/modal/examples/ExProgrammatic.vue | 3 ++- src/components/modal/Modal.vue | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/docs/pages/components/modal/examples/ExProgrammatic.vue b/docs/pages/components/modal/examples/ExProgrammatic.vue index 05320bc9f..3bf8f9014 100644 --- a/docs/pages/components/modal/examples/ExProgrammatic.vue +++ b/docs/pages/components/modal/examples/ExProgrammatic.vue @@ -65,7 +65,8 @@ parent: this, component: ModalForm, hasModalCard: true, - customClass: 'custom-class custom-class-2' + customClass: 'custom-class custom-class-2', + trapFocus: true }) } } diff --git a/src/components/modal/Modal.vue b/src/components/modal/Modal.vue index a49c0df45..17ab876ea 100644 --- a/src/components/modal/Modal.vue +++ b/src/components/modal/Modal.vue @@ -135,14 +135,14 @@ export default { watch: { active(value) { this.isActive = value + }, + isActive(value) { + this.handleScroll() this.$nextTick(() => { if (value && this.$el && this.$el.focus) { this.$el.focus() } }) - }, - isActive() { - this.handleScroll() } }, methods: {