From 41a90c01c3d3dba55e0579451c1f9cfdcc51e00b Mon Sep 17 00:00:00 2001 From: Chris LaFreniere <40371649+chlafreniere@users.noreply.github.com> Date: Fri, 21 Feb 2020 15:54:21 -0800 Subject: [PATCH] Listen to escape key to close nb find widget (#9247) --- .../workbench/contrib/notebook/find/notebookFindWidget.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/sql/workbench/contrib/notebook/find/notebookFindWidget.ts b/src/sql/workbench/contrib/notebook/find/notebookFindWidget.ts index cc880b0ebf..2845b752b5 100644 --- a/src/sql/workbench/contrib/notebook/find/notebookFindWidget.ts +++ b/src/sql/workbench/contrib/notebook/find/notebookFindWidget.ts @@ -161,6 +161,14 @@ export class FindWidget extends Widget implements IOverlayWidget, IHorizontalSas this._applyTheme(themeService.getTheme()); this._register(themeService.onThemeChange(this._applyTheme.bind(this))); + + this.onkeyup(this._domNode, e => { + if (e.equals(KeyCode.Escape)) { + this._state.change({ isRevealed: false, searchScope: null }, false); + e.preventDefault(); + return; + } + }); } // ----- IOverlayWidget API