Skip to content

Commit

Permalink
popup chat close on esc added.
Browse files Browse the repository at this point in the history
  • Loading branch information
barisgul15 committed Dec 25, 2023
1 parent 4ef1319 commit d9cd998
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions web/template/popup-chat.gohtml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@
</head>
<body class="bg-white dark:bg-secondary h-screen" x-data="interaction.popupContext({{$stream.ID}})">
{{template "chat-component" .}}
<script> interaction.closeChatOnEscapePressed(); </script>
</body>
8 changes: 8 additions & 0 deletions web/ts/components/popup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,11 @@ export function popupContext(streamId: number): AlpineComponent {
},
} as AlpineComponent;
}

export function closeChatOnEscapePressed() {
document.addEventListener("keyup", function (event) {
if (event.key === "Escape") {
window.close();
}
});
}

0 comments on commit d9cd998

Please sign in to comment.