1
0
mirror of https://github.com/bitwarden/browser.git synced 2025-01-06 18:57:56 +01:00

[PM-16102] Display autofill shortcut on Fill button hover (#12502)

This commit is contained in:
Victoria League 2024-12-23 10:37:12 -05:00 committed by GitHub
parent 0619ef507f
commit 23210f4a39
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 28 additions and 3 deletions

View File

@ -55,7 +55,7 @@
bitBadge
variant="primary"
(click)="doAutofill(cipher)"
[title]="'autofillTitle' | i18n: cipher.name"
[title]="autofillShortcutTooltip() ?? ('autofillTitle' | i18n: cipher.name)"
[attr.aria-label]="'autofillTitle' | i18n: cipher.name"
>
{{ "fill" | i18n }}

View File

@ -2,12 +2,22 @@
// @ts-strict-ignore
import { ScrollingModule } from "@angular/cdk/scrolling";
import { CommonModule } from "@angular/common";
import { booleanAttribute, Component, EventEmitter, inject, Input, Output } from "@angular/core";
import {
AfterViewInit,
booleanAttribute,
Component,
EventEmitter,
inject,
Input,
Output,
signal,
} from "@angular/core";
import { Router, RouterLink } from "@angular/router";
import { map } from "rxjs";
import { JslibModule } from "@bitwarden/angular/jslib.module";
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service";
import { CipherView } from "@bitwarden/common/vault/models/view/cipher.view";
import {
@ -50,7 +60,7 @@ import { ItemMoreOptionsComponent } from "../item-more-options/item-more-options
templateUrl: "vault-list-items-container.component.html",
standalone: true,
})
export class VaultListItemsContainerComponent {
export class VaultListItemsContainerComponent implements AfterViewInit {
private compactModeService = inject(CompactModeService);
/**
@ -133,14 +143,29 @@ export class VaultListItemsContainerComponent {
return cipher.collections[0]?.name;
}
protected autofillShortcutTooltip = signal<string | undefined>(undefined);
constructor(
private i18nService: I18nService,
private vaultPopupAutofillService: VaultPopupAutofillService,
private passwordRepromptService: PasswordRepromptService,
private cipherService: CipherService,
private router: Router,
private platformUtilsService: PlatformUtilsService,
) {}
async ngAfterViewInit() {
const autofillShortcut = await this.platformUtilsService.getAutofillKeyboardShortcut();
if (autofillShortcut === "") {
this.autofillShortcutTooltip.set(undefined);
} else {
const autofillTitle = this.i18nService.t("autoFill");
this.autofillShortcutTooltip.set(`${autofillTitle} ${autofillShortcut}`);
}
}
/**
* Launches the login cipher in a new browser tab.
*/