Skip to content

Commit de172fb

Browse files
authored
Merge pull request #311093 from microsoft/territorial-asp
Change close button
2 parents a6209df + cd2e1d8 commit de172fb

2 files changed

Lines changed: 43 additions & 18 deletions

File tree

src/vs/workbench/contrib/welcomeOnboarding/browser/media/variationA.css

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
display: flex;
4343
flex-direction: column;
4444
overflow: hidden;
45+
position: relative;
4546
transform: scale(0.96) translateY(8px);
4647
transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
4748
}
@@ -61,6 +62,36 @@
6162
padding: 20px 28px 0;
6263
}
6364

65+
.onboarding-a-close-btn {
66+
position: absolute;
67+
top: 16px;
68+
right: 16px;
69+
z-index: 1;
70+
display: flex;
71+
align-items: center;
72+
justify-content: center;
73+
width: 28px;
74+
height: 28px;
75+
border: none;
76+
border-radius: 6px;
77+
background: transparent;
78+
color: var(--vscode-descriptionForeground);
79+
cursor: pointer;
80+
padding: 0;
81+
flex-shrink: 0;
82+
transition: background 0.15s ease, color 0.15s ease;
83+
}
84+
85+
.onboarding-a-close-btn:hover {
86+
background: var(--vscode-toolbar-hoverBackground, rgba(255, 255, 255, 0.1));
87+
color: var(--vscode-editor-foreground);
88+
}
89+
90+
.onboarding-a-close-btn:focus-visible {
91+
outline: 2px solid var(--vscode-focusBorder);
92+
outline-offset: 2px;
93+
}
94+
6495
.onboarding-a-progress {
6596
display: flex;
6697
align-items: center;

src/vs/workbench/contrib/welcomeOnboarding/browser/onboardingVariationA.ts

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ export class OnboardingVariationA extends Disposable implements IOnboardingServi
105105
private contentEl: HTMLElement | undefined;
106106
private backButton: HTMLButtonElement | undefined;
107107
private nextButton: HTMLButtonElement | undefined;
108-
private skipButton: HTMLButtonElement | undefined;
108+
private closeButton: HTMLButtonElement | undefined;
109109
private footerLeft: HTMLElement | undefined;
110110
private _footerSignInBtn: HTMLButtonElement | undefined;
111111

@@ -176,6 +176,12 @@ export class OnboardingVariationA extends Disposable implements IOnboardingServi
176176
// Card
177177
this.card = append(this.overlay, $('.onboarding-a-card'));
178178

179+
// Close button (upper-right corner of card)
180+
this.closeButton = append(this.card, $<HTMLButtonElement>('button.onboarding-a-close-btn'));
181+
this.closeButton.type = 'button';
182+
this.closeButton.setAttribute('aria-label', localize('onboarding.close', "Close"));
183+
this.closeButton.appendChild(renderIcon(Codicon.close));
184+
179185
// Header with progress
180186
const header = append(this.card, $('.onboarding-a-header'));
181187
this.progressContainer = append(header, $('.onboarding-a-progress'));
@@ -194,10 +200,6 @@ export class OnboardingVariationA extends Disposable implements IOnboardingServi
194200
const footer = append(this.card, $('.onboarding-a-footer'));
195201

196202
this.footerLeft = append(footer, $('.onboarding-a-footer-left'));
197-
this.skipButton = append(this.footerLeft, $<HTMLButtonElement>('button.onboarding-a-btn.onboarding-a-btn-ghost'));
198-
this.skipButton.textContent = localize('onboarding.skip', "Skip");
199-
this.skipButton.type = 'button';
200-
this.footerFocusableElements.push(this.skipButton);
201203

202204
const footerRight = append(footer, $('.onboarding-a-footer-right'));
203205

@@ -212,7 +214,7 @@ export class OnboardingVariationA extends Disposable implements IOnboardingServi
212214
this._updateButtonStates();
213215

214216
// Event handlers
215-
this.disposables.add(addDisposableListener(this.skipButton, EventType.CLICK, () => {
217+
this.disposables.add(addDisposableListener(this.closeButton, EventType.CLICK, () => {
216218
this._logAction('skip');
217219
this._dismiss('skip');
218220
}));
@@ -412,15 +414,8 @@ export class OnboardingVariationA extends Disposable implements IOnboardingServi
412414
this.nextButton.textContent = localize('onboarding.next', "Continue");
413415
}
414416
}
415-
if (this.skipButton && this.footerLeft) {
416-
if (this.currentStepIndex === 0) {
417-
// Sign-in step: ghost Skip button
418-
this.skipButton.className = 'onboarding-a-btn onboarding-a-btn-ghost';
419-
} else {
420-
this.skipButton.className = 'onboarding-a-btn onboarding-a-btn-ghost';
421-
}
417+
if (this.footerLeft) {
422418
if (this._isLastStep()) {
423-
this.skipButton.style.display = 'none';
424419
// Show sign-in nudge in footer
425420
if (!this._footerSignInBtn && !this._userSignedIn) {
426421
this._footerSignInBtn = append(this.footerLeft, $<HTMLButtonElement>('button.onboarding-a-signin-nudge-btn'));
@@ -435,7 +430,6 @@ export class OnboardingVariationA extends Disposable implements IOnboardingServi
435430
}));
436431
}
437432
} else {
438-
this.skipButton.style.display = '';
439433
if (this._footerSignInBtn) {
440434
this._footerSignInBtn.remove();
441435
this._footerSignInBtn = undefined;
@@ -1149,12 +1143,12 @@ export class OnboardingVariationA extends Disposable implements IOnboardingServi
11491143
}
11501144

11511145
private _getFocusableElements(): HTMLElement[] {
1152-
return [...this.stepFocusableElements, ...this.footerFocusableElements].filter(element => this._isTabbable(element));
1146+
return [...(this.closeButton ? [this.closeButton] : []), ...this.stepFocusableElements, ...this.footerFocusableElements].filter(element => this._isTabbable(element));
11531147
}
11541148

11551149
private _focusCurrentStepElement(): void {
11561150
const stepFocusable = this.stepFocusableElements.find(element => this._isTabbable(element));
1157-
(stepFocusable ?? this.nextButton ?? this.skipButton)?.focus();
1151+
(stepFocusable ?? this.nextButton ?? this.closeButton)?.focus();
11581152
}
11591153

11601154
private _registerStepFocusable<T extends HTMLElement>(element: T): T {
@@ -1210,7 +1204,7 @@ export class OnboardingVariationA extends Disposable implements IOnboardingServi
12101204
this.contentEl = undefined;
12111205
this.backButton = undefined;
12121206
this.nextButton = undefined;
1213-
this.skipButton = undefined;
1207+
this.closeButton = undefined;
12141208
this.footerLeft = undefined;
12151209
this._footerSignInBtn = undefined;
12161210
this.footerFocusableElements.length = 0;

0 commit comments

Comments
 (0)