Skip to content

Commit 21f2e10

Browse files
committed
update step focus logic for first launch in Getting Started page
1 parent 6c10697 commit 21f2e10

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

src/vs/workbench/contrib/chat/browser/chatWidget.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1085,6 +1085,7 @@ export class ChatWidget extends Disposable implements IChatWidget {
10851085

10861086
if (numItems === 0) {
10871087
this.refreshHistoryList();
1088+
this.focusInput();
10881089
}
10891090
}
10901091

src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStarted.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -760,7 +760,7 @@ export class GettingStartedPage extends EditorPane {
760760
return '';
761761
}
762762

763-
private async selectStep(id: string | undefined, delayFocus = true) {
763+
private async selectStep(id: string | undefined, delayFocus = true, firstLaunch = false) {
764764
if (id) {
765765
let stepElement = this.container.querySelector<HTMLDivElement>(`[data-step-id="${id}"]`);
766766
if (!stepElement) {
@@ -782,7 +782,9 @@ export class GettingStartedPage extends EditorPane {
782782
}
783783
}
784784
});
785-
setTimeout(() => (stepElement as HTMLElement).focus(), delayFocus && this.shouldAnimate() ? SLIDE_TRANSITION_TIME_MS : 0);
785+
if (!firstLaunch) {
786+
setTimeout(() => (stepElement as HTMLElement).focus(), delayFocus && this.shouldAnimate() ? SLIDE_TRANSITION_TIME_MS : 0);
787+
}
786788

787789
this.editorInput.selectedStep = id;
788790

@@ -952,7 +954,7 @@ export class GettingStartedPage extends EditorPane {
952954
this.currentWalkthrough = first;
953955
this.editorInput.selectedCategory = this.currentWalkthrough?.id;
954956
this.editorInput.walkthroughPageTitle = this.currentWalkthrough.walkthroughPageTitle;
955-
this.buildCategorySlide(this.editorInput.selectedCategory, undefined);
957+
this.buildCategorySlide(this.editorInput.selectedCategory, undefined, true /* firstLaunch */);
956958
this.setSlide('details', true /* firstLaunch */);
957959
return;
958960
}
@@ -1388,7 +1390,7 @@ export class GettingStartedPage extends EditorPane {
13881390
super.clearInput();
13891391
}
13901392

1391-
private buildCategorySlide(categoryID: string, selectedStep?: string) {
1393+
private buildCategorySlide(categoryID: string, selectedStep?: string, firstLaunch?: boolean) {
13921394
if (this.detailsScrollbar) { this.detailsScrollbar.dispose(); }
13931395

13941396
this.extensionService.whenInstalledExtensionsRegistered().then(() => {
@@ -1531,7 +1533,7 @@ export class GettingStartedPage extends EditorPane {
15311533
reset(this.stepsContent, categoryDescriptorComponent, stepListComponent, this.stepMediaComponent, categoryFooter);
15321534

15331535
const toExpand = category.steps.find(step => this.contextService.contextMatchesRules(step.when) && !step.done) ?? category.steps[0];
1534-
this.selectStep(selectedStep ?? toExpand.id, !selectedStep);
1536+
this.selectStep(selectedStep ?? toExpand.id, !selectedStep, firstLaunch);
15351537

15361538
this.detailsScrollbar.scanDomNode();
15371539
this.detailsPageScrollbar?.scanDomNode();

0 commit comments

Comments
 (0)