diff --git a/apps/browser/src/autofill/popup/fido2/fido2.component.html b/apps/browser/src/autofill/popup/fido2/fido2.component.html
index dc9f3ff83f..80ea6726cb 100644
--- a/apps/browser/src/autofill/popup/fido2/fido2.component.html
+++ b/apps/browser/src/autofill/popup/fido2/fido2.component.html
@@ -49,17 +49,22 @@
- {{ "noMatchingLoginsForSite" | i18n }}
- {{ "searchSavePasskeyNewLogin" | i18n }}
+ {{
+ (hasSearched ? "noItemsMatchSearch" : "noMatchingLoginsForSite") | i18n
+ }}
+ {{
+ (hasSearched ? "searchSavePasskeyNewLogin" : "clearFiltersOrTryAnother") | i18n
+ }}
+
@@ -100,17 +105,22 @@
- {{ "noItemsMatchSearch" | i18n }}
- {{ "clearFiltersOrTryAnother" | i18n }}
+ {{
+ (hasSearched ? "noItemsMatchSearch" : "noMatchingLoginsForSite") | i18n
+ }}
+ {{
+ (hasSearched ? "searchSavePasskeyNewLogin" : "clearFiltersOrTryAnother") | i18n
+ }}
+
diff --git a/apps/browser/src/autofill/popup/fido2/fido2.component.ts b/apps/browser/src/autofill/popup/fido2/fido2.component.ts
index cf0fd90a8f..82be95ea0d 100644
--- a/apps/browser/src/autofill/popup/fido2/fido2.component.ts
+++ b/apps/browser/src/autofill/popup/fido2/fido2.component.ts
@@ -91,7 +91,6 @@ interface ViewData {
export class Fido2Component implements OnInit, OnDestroy {
private destroy$ = new Subject();
private message$ = new BehaviorSubject(null);
- private hasSearched = false;
protected BrowserFido2MessageTypes = BrowserFido2MessageTypes;
protected cipher: CipherView;
protected ciphers?: CipherView[] = [];
@@ -104,6 +103,7 @@ export class Fido2Component implements OnInit, OnDestroy {
protected noResultsIcon = Icons.NoResults;
protected passkeyAction: PasskeyActionValue = PasskeyActions.Register;
protected PasskeyActions = PasskeyActions;
+ protected hasSearched = false;
protected searchText: string;
protected searchTypeSearch = false;
protected senderTabId?: string;
@@ -370,19 +370,30 @@ export class Fido2Component implements OnInit, OnDestroy {
return this.equivalentDomains;
}
+ async clearSearch() {
+ this.searchText = "";
+ await this.setDisplayedCiphersToAllDomainMatch();
+ }
+
+ protected async setDisplayedCiphersToAllDomainMatch() {
+ const equivalentDomains = await this.getEquivalentDomains();
+ this.displayedCiphers = this.ciphers.filter((cipher) =>
+ cipher.login.matchesUri(this.url, equivalentDomains),
+ );
+ }
+
protected async search() {
- this.hasSearched = await this.searchService.isSearchable(this.searchText);
- if (this.hasSearched) {
+ this.hasSearched = true;
+ const isSearchable = await this.searchService.isSearchable(this.searchText);
+
+ if (isSearchable) {
this.displayedCiphers = await this.searchService.searchCiphers(
this.searchText,
null,
this.ciphers,
);
} else {
- const equivalentDomains = await this.getEquivalentDomains();
- this.displayedCiphers = this.ciphers.filter((cipher) =>
- cipher.login.matchesUri(this.url, equivalentDomains),
- );
+ await this.setDisplayedCiphersToAllDomainMatch();
}
}