Skip to content

Commit

Permalink
grab changes from
Browse files Browse the repository at this point in the history
  • Loading branch information
indirectlylit committed Aug 4, 2020
1 parent 15d7935 commit 0d1c9cb
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions lib/KModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -291,23 +291,23 @@
this.$refs.modal.focus();
},
focusElementTest(event) {
// switching apps - not relevant
if (event.target === window) {
const { target } = event;
const noopOnFocus =
target === window || // switching apps
!this.$refs.modal || // if $refs.modal isn't available
target === this.$refs.modal || // addresses #3824
this.$refs.modal.contains(target.activeElement);
if (noopOnFocus) {
return;
}
// not sure when this would be true
if (!this.$refs.modal) {
return;
}
// addresses https://github.com/learningequality/kolibri/issues/3824
if (
event.target === this.$refs.modal ||
this.$refs.modal.contains(event.target.activeElement)
) {
// Fixes possible infinite recursion when disconnection snackbars appear
// along with KModal (#6301)
const $coreSnackbar = document.getElementById('coresnackbar');
if ($coreSnackbar && $coreSnackbar.contains(target)) {
return;
}
// focus has escaped the modal - put it back!
if (!this.$refs.modal.contains(event.target)) {
if (!this.$refs.modal.contains(target)) {
this.focusModal();
}
},
Expand Down

0 comments on commit 0d1c9cb

Please sign in to comment.