Skip to content

Commit

Permalink
Do not change focus if activeComponent is in modal content. (#378)
Browse files Browse the repository at this point in the history
This allows focus to be set in @shown handler of a modal without
the focusFirst handler overriding.
  • Loading branch information
charkins authored and pi0 committed May 11, 2017
1 parent a734d99 commit 25e1959
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/components/modal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,11 @@
}
},
focusFirst() {
// If activeElement is child of content, no need to change focus
if (document.activeElement && this.$refs.content.contains(document.activeElement)) {
return;
}
// Focus the modal's first focusable item, searching footer, then body, then header, else the modal
let el;
if (this.$refs.footer) {
Expand Down

0 comments on commit 25e1959

Please sign in to comment.