From b148b2f0b5c1f3f1dca553fbf97cfd24f3ce423f Mon Sep 17 00:00:00 2001 From: Olivier Gagnon Date: Mon, 23 Aug 2021 01:15:20 -0400 Subject: [PATCH] logbox close on escape now --- css/popupboxes.scss | 7 +++++++ utils/LogBox.tsx | 14 ++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/css/popupboxes.scss b/css/popupboxes.scss index afd79d1d6..febd5ef4b 100644 --- a/css/popupboxes.scss +++ b/css/popupboxes.scss @@ -112,6 +112,13 @@ background-color: #000; } +.log-box-button:hover, +.log-box-button:focus { + color: var(--my-font-color); + text-decoration: none; + cursor: pointer; +} + .dialog-box-content { z-index: 2; background-color: var(--my-background-color); diff --git a/utils/LogBox.tsx b/utils/LogBox.tsx index d1c8e8aff..7063193a2 100644 --- a/utils/LogBox.tsx +++ b/utils/LogBox.tsx @@ -48,6 +48,20 @@ function ScriptLogPopup(props: IProps): React.ReactElement { removeElementById(props.id); } + useEffect(() => { + function closeHandler(event: KeyboardEvent) { + if(event.keyCode === 27) { + close(); + } + } + + document.addEventListener('keydown', closeHandler); + + return () => { + document.removeEventListener('keydown', closeHandler); + } + }, []); + function kill(): void { killWorkerScript(props.script, props.script.server, true); close();