Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Focus on Modal when `isActive` is changed
  • Loading branch information
service-paradis committed Dec 19, 2019
1 parent cd624cf commit ff6cab9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion docs/pages/components/modal/examples/ExProgrammatic.vue
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@
parent: this,
component: ModalForm,
hasModalCard: true,
customClass: 'custom-class custom-class-2'
customClass: 'custom-class custom-class-2',
trapFocus: true
})
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/components/modal/Modal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down

0 comments on commit ff6cab9

Please sign in to comment.