From 385e4a22450d4549d58a262dcd503e636f1ed30d Mon Sep 17 00:00:00 2001 From: Alan Ren Date: Mon, 13 Feb 2023 19:43:16 -0800 Subject: [PATCH] move the focus to newly added filter field. (#21930) --- .../services/profiler/browser/profilerFilterDialog.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/sql/workbench/services/profiler/browser/profilerFilterDialog.ts b/src/sql/workbench/services/profiler/browser/profilerFilterDialog.ts index eb08977a0d..a0b683acdf 100644 --- a/src/sql/workbench/services/profiler/browser/profilerFilterDialog.ts +++ b/src/sql/workbench/services/profiler/browser/profilerFilterDialog.ts @@ -128,7 +128,11 @@ export class ProfilerFilterDialog extends Modal { this.addClauseRow(true, clause.field, this.convertToOperatorString(clause.operator), clause.value); }); - this.createClauseTableActionLink(AddClauseText, body, () => { this.addClauseRow(false); }); + this.createClauseTableActionLink(AddClauseText, body, () => { + this.addClauseRow(false); + // Set keyboard focus to the newly added clause. + this._clauseRows[this._clauseRows.length - 1]?.field?.focus(); + }); this.createClauseTableActionLink(ClearText, body, () => { this.handleClearButtonClick(); }); } @@ -168,6 +172,7 @@ export class ProfilerFilterDialog extends Modal { DOM.addStandardDisposableListener(actionLink, DOM.EventType.KEY_DOWN, (e: StandardKeyboardEvent) => { if (e.equals(KeyCode.Space) || e.equals(KeyCode.Enter)) { handler(); + e.preventDefault(); e.stopPropagation(); } });