From 83fa879270e271dd487db2fccd48afeed61b59c6 Mon Sep 17 00:00:00 2001 From: White Hsu Date: Thu, 27 Oct 2022 23:55:59 +0800 Subject: [PATCH] [GH-#10878] Fix bug of Getting Start Widget Accept Focus Signed-off-by: White Hsu --- .../src/browser/getting-started-widget.tsx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/getting-started/src/browser/getting-started-widget.tsx b/packages/getting-started/src/browser/getting-started-widget.tsx index 5f3b363c30f56..f9c8fb10decb6 100644 --- a/packages/getting-started/src/browser/getting-started-widget.tsx +++ b/packages/getting-started/src/browser/getting-started-widget.tsx @@ -17,7 +17,7 @@ import * as React from '@theia/core/shared/react'; import URI from '@theia/core/lib/common/uri'; import { injectable, inject, postConstruct } from '@theia/core/shared/inversify'; -import { ReactWidget } from '@theia/core/lib/browser/widgets/react-widget'; +import { Message, ReactWidget } from '@theia/core/lib/browser'; import { CommandRegistry, isOSX, environment, Path } from '@theia/core/lib/common'; import { WorkspaceCommands, WorkspaceService } from '@theia/workspace/lib/browser'; import { KeymapsCommands } from '@theia/keymaps/lib/browser'; @@ -111,6 +111,14 @@ export class GettingStartedWidget extends ReactWidget { this.update(); } + protected override onActivateRequest(msg: Message): void { + super.onActivateRequest(msg); + const htmlElement = document.getElementById('getting.started.widget'); + if (htmlElement) { + htmlElement?.focus(); + } + } + /** * Render the content of the widget. */