diff --git a/web/template/popup-chat.gohtml b/web/template/popup-chat.gohtml index ba0c9f442..ecc9d1b03 100644 --- a/web/template/popup-chat.gohtml +++ b/web/template/popup-chat.gohtml @@ -1,6 +1,7 @@ {{- /*gotype: github.com/TUM-Dev/gocast/web.ChatData*/ -}} {{$course := .IndexData.TUMLiveContext.Course}} {{$stream := .IndexData.TUMLiveContext.Stream}} +{{- $closeChatFunction := `closeChatOnEscapePressed();` -}}
@@ -19,4 +20,7 @@ {{template "chat-component" .}} + diff --git a/web/ts/components/popup.ts b/web/ts/components/popup.ts index 568f18a89..146b12fd0 100644 --- a/web/ts/components/popup.ts +++ b/web/ts/components/popup.ts @@ -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(); + } + }); +}