From cb3435a71b1350490476cc62f059fd41aed7a0ab Mon Sep 17 00:00:00 2001 From: sienori Date: Sun, 3 Jun 2018 13:47:53 +0900 Subject: [PATCH] Close the panel with pressing Escape key --- simple-translate/simple-translate.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/simple-translate/simple-translate.js b/simple-translate/simple-translate.js index 8085677..584a08b 100644 --- a/simple-translate/simple-translate.js +++ b/simple-translate/simple-translate.js @@ -125,6 +125,11 @@ function hidePanel(e) { } } +//Esc押下でパネルを閉じる +document.addEventListener('keydown', (e) => { + if (e.key == 'Escape') hidePanel(e); +}) + //パネルがウィンドウ外にはみ出る時に位置を調整 function panelPosition(e) { var p = new Object();