Skip to content

Commit

Permalink
[PM-16102] Display autofill shortcut on Fill button hover
Browse files Browse the repository at this point in the history
  • Loading branch information
vleague2 committed Dec 20, 2024
1 parent 8caadac commit b89dcad
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,11 @@ <h2 bitTypography="h6">
bitBadge
variant="primary"
(click)="doAutofill(cipher)"
[title]="'autofillTitle' | i18n: cipher.name"
[title]="
autofillShortcutTooltip()
? autofillShortcutTooltip()
: ('autofillTitle' | i18n: cipher.name)
"
[attr.aria-label]="'autofillTitle' | i18n: cipher.name"
>
{{ "fill" | i18n }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Check warning on line 5 in apps/browser/src/vault/popup/components/vault-v2/vault-list-items-container/vault-list-items-container.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/browser/src/vault/popup/components/vault-v2/vault-list-items-container/vault-list-items-container.component.ts#L5

Added line #L5 was not covered by tests
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";

Check warning on line 20 in apps/browser/src/vault/popup/components/vault-v2/vault-list-items-container/vault-list-items-container.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/browser/src/vault/popup/components/vault-v2/vault-list-items-container/vault-list-items-container.component.ts#L20

Added line #L20 was not covered by tests
import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service";
import { CipherView } from "@bitwarden/common/vault/models/view/cipher.view";
import {
Expand Down Expand Up @@ -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 {

Check warning on line 63 in apps/browser/src/vault/popup/components/vault-v2/vault-list-items-container/vault-list-items-container.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/browser/src/vault/popup/components/vault-v2/vault-list-items-container/vault-list-items-container.component.ts#L63

Added line #L63 was not covered by tests
private compactModeService = inject(CompactModeService);

/**
Expand Down Expand Up @@ -133,14 +143,29 @@ export class VaultListItemsContainerComponent {
return cipher.collections[0]?.name;
}

protected autofillShortcutTooltip = signal<string | undefined>(undefined);

Check warning on line 146 in apps/browser/src/vault/popup/components/vault-v2/vault-list-items-container/vault-list-items-container.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/browser/src/vault/popup/components/vault-v2/vault-list-items-container/vault-list-items-container.component.ts#L146

Added line #L146 was not covered by tests

constructor(
private i18nService: I18nService,
private vaultPopupAutofillService: VaultPopupAutofillService,
private passwordRepromptService: PasswordRepromptService,
private cipherService: CipherService,
private router: Router,
private platformUtilsService: PlatformUtilsService,

Check warning on line 154 in apps/browser/src/vault/popup/components/vault-v2/vault-list-items-container/vault-list-items-container.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/browser/src/vault/popup/components/vault-v2/vault-list-items-container/vault-list-items-container.component.ts#L154

Added line #L154 was not covered by tests
) {}

async ngAfterViewInit() {
const autofillShortcut = await this.platformUtilsService.getAutofillKeyboardShortcut();

Check warning on line 158 in apps/browser/src/vault/popup/components/vault-v2/vault-list-items-container/vault-list-items-container.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/browser/src/vault/popup/components/vault-v2/vault-list-items-container/vault-list-items-container.component.ts#L158

Added line #L158 was not covered by tests

if (autofillShortcut === "") {
this.autofillShortcutTooltip.set(undefined);

Check warning on line 161 in apps/browser/src/vault/popup/components/vault-v2/vault-list-items-container/vault-list-items-container.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/browser/src/vault/popup/components/vault-v2/vault-list-items-container/vault-list-items-container.component.ts#L161

Added line #L161 was not covered by tests
} else {
const autofillTitle = this.i18nService.t("autoFill");

Check warning on line 163 in apps/browser/src/vault/popup/components/vault-v2/vault-list-items-container/vault-list-items-container.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/browser/src/vault/popup/components/vault-v2/vault-list-items-container/vault-list-items-container.component.ts#L163

Added line #L163 was not covered by tests

this.autofillShortcutTooltip.set(`${autofillTitle} ${autofillShortcut}`);

Check warning on line 165 in apps/browser/src/vault/popup/components/vault-v2/vault-list-items-container/vault-list-items-container.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/browser/src/vault/popup/components/vault-v2/vault-list-items-container/vault-list-items-container.component.ts#L165

Added line #L165 was not covered by tests
}
}

/**
* Launches the login cipher in a new browser tab.
*/
Expand Down

0 comments on commit b89dcad

Please sign in to comment.