Skip to content

Commit

Permalink
feat: allow closing the share modal by pressing the escape key
Browse files Browse the repository at this point in the history
  • Loading branch information
GabsEdits authored and mirkobrombin committed Jul 31, 2024
1 parent 2fbb828 commit 6d521f3
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/components/ShareModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,14 @@ export default defineComponent({
closeModal() {
this.$emit('close');
},
handleKeyboardEvent(event: KeyboardEvent) {
if (event.key === "Escape") {
this.closeModal();
}
},
},
mounted() {
window.addEventListener("keydown", this.handleKeyboardEvent);
}
});
</script>

0 comments on commit 6d521f3

Please sign in to comment.