Skip to content

Commit

Permalink
popup chat close on esc added. (TUM-Dev#1281)
Browse files Browse the repository at this point in the history
* popup chat close on esc added.

* Update popup-chat.gohtml

---------

Co-authored-by: Sebastian <sebiwrn@web.de>
  • Loading branch information
barisgul15 and SebiWrn committed Dec 28, 2023
1 parent 27bf25f commit 2f203ba
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion web/template/popup-chat.gohtml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@
<link href="/static/assets/css-dist/home.css?v={{if .IndexData.VersionTag}}{{.IndexData.VersionTag}}{{else}}development{{end}}"
rel="stylesheet">
</head>
<body class="bg-white dark:bg-secondary h-screen" x-data="interaction.popupContext({{$stream.ID}})">
<body class="bg-white dark:bg-secondary h-screen" x-data="interaction.popupContext({{$stream.ID}})" x-init="interaction.closeChatOnEscapePressed()">
{{template "chat-component" .}}
</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 2f203ba

Please sign in to comment.