fixed escape not focusing modal window

pull/7149/head
andrii.yurchuk 3 years ago
parent 4b734f44c6
commit 702d024dba

@ -31,11 +31,29 @@ export default {
close() { close() {
this.dialog = false; this.dialog = false;
}, },
focusDialog() {
this.$nextTick(() => {
setTimeout(() => {
const dialogEl = document.querySelector('.v-dialog--active');
if (dialogEl) {
dialogEl.setAttribute('tabindex', '1');
dialogEl.focus();
}
}, 1000);
});
}
}, },
mounted() { mounted() {
this.$root.$on('openImageModal', (photoUrl, photoAlt) => { this.$root.$on('openImageModal', (photoUrl, photoAlt) => {
this.open(photoUrl, photoAlt); this.open(photoUrl, photoAlt);
}); });
}, },
watch: {
dialog(val) {
if (val) {
this.focusDialog();
}
},
},
}; };
</script> </script>

Loading…
Cancel
Save