1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-22 11:45:59 +01:00

[PM-8582] Improve search performance in Safari (#11088)

This commit is contained in:
Victoria League 2024-09-18 09:13:58 -04:00 committed by GitHub
parent 502d8ed729
commit bd4b3933a4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 7 additions and 2 deletions

View File

@ -10,7 +10,7 @@
<input <input
#input #input
bitInput bitInput
type="search" [type]="inputType"
[id]="id" [id]="id"
[placeholder]="placeholder ?? ('search' | i18n)" [placeholder]="placeholder ?? ('search' | i18n)"
class="tw-rounded-l tw-pl-9" class="tw-rounded-l tw-pl-9"

View File

@ -1,6 +1,8 @@
import { Component, ElementRef, Input, ViewChild } from "@angular/core"; import { Component, ElementRef, Input, ViewChild } from "@angular/core";
import { ControlValueAccessor, NG_VALUE_ACCESSOR } from "@angular/forms"; import { ControlValueAccessor, NG_VALUE_ACCESSOR } from "@angular/forms";
import { isBrowserSafariApi } from "@bitwarden/platform";
import { FocusableElement } from "../shared/focusable-element"; import { FocusableElement } from "../shared/focusable-element";
let nextId = 0; let nextId = 0;
@ -28,6 +30,8 @@ export class SearchComponent implements ControlValueAccessor, FocusableElement {
protected id = `search-id-${nextId++}`; protected id = `search-id-${nextId++}`;
protected searchText: string; protected searchText: string;
// Use `type="text"` for Safari to improve rendering performance
protected inputType = isBrowserSafariApi() ? ("text" as const) : ("search" as const);
@Input() disabled: boolean; @Input() disabled: boolean;
@Input() placeholder: string; @Input() placeholder: string;

View File

@ -20,7 +20,8 @@
"lib": ["es2020", "dom"], "lib": ["es2020", "dom"],
"paths": { "paths": {
"@bitwarden/common/*": ["../common/src/*"], "@bitwarden/common/*": ["../common/src/*"],
"@bitwarden/angular/*": ["../angular/src/*"] "@bitwarden/angular/*": ["../angular/src/*"],
"@bitwarden/platform": ["../platform/src"]
} }
}, },
"angularCompilerOptions": { "angularCompilerOptions": {