1
0
mirror of https://github.com/bitwarden/browser synced 2026-02-09 05:00:10 +00:00

Improve SSH agent approval dialog UX

- Prevent accidental dismissal by disabling backdrop click (disableClose)
- Add 1.5s delay before Authorize button becomes clickable
- Fix Deny button to properly close dialog with false result

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Anders Åberg
2025-12-18 12:01:34 +01:00
parent ad4b6a30a0
commit 2fed61ee2d
2 changed files with 24 additions and 4 deletions

View File

@@ -13,10 +13,16 @@
{{ "sshkeyApprovalMessageSuffix" | i18n }} {{ params.action | i18n }}
</div>
<ng-container bitDialogFooter>
<button type="submit" bitButton bitFormButton buttonType="primary">
<button
type="submit"
bitButton
bitFormButton
buttonType="primary"
[disabled]="!authorizeEnabled"
>
<span>{{ "authorize" | i18n }}</span>
</button>
<button type="button" bitButton bitFormButton buttonType="secondary" bitDialogClose>
<button type="button" bitButton bitFormButton buttonType="secondary" (click)="deny()">
{{ "deny" | i18n }}
</button>
</ng-container>

View File

@@ -1,5 +1,5 @@
import { CommonModule } from "@angular/common";
import { Component, Inject } from "@angular/core";
import { Component, Inject, OnInit } from "@angular/core";
import { FormBuilder, ReactiveFormsModule } from "@angular/forms";
import { JslibModule } from "@bitwarden/angular/jslib.module";
@@ -39,8 +39,11 @@ export interface ApproveSshRequestParams {
CalloutModule,
],
})
export class ApproveSshRequestComponent {
export class ApproveSshRequestComponent implements OnInit {
approveSshRequestForm = this.formBuilder.group({});
authorizeEnabled = false;
private static readonly AUTHORIZE_DELAY_MS = 1500;
constructor(
@Inject(DIALOG_DATA) protected params: ApproveSshRequestParams,
@@ -48,6 +51,12 @@ export class ApproveSshRequestComponent {
private formBuilder: FormBuilder,
) {}
ngOnInit(): void {
setTimeout(() => {
this.authorizeEnabled = true;
}, ApproveSshRequestComponent.AUTHORIZE_DELAY_MS);
}
static open(
dialogService: DialogService,
cipherName: string,
@@ -69,10 +78,15 @@ export class ApproveSshRequestComponent {
isAgentForwarding,
action: actioni18nKey,
},
disableClose: true,
});
}
submit = async () => {
this.dialogRef.close(true);
};
deny(): void {
this.dialogRef.close(false);
}
}