1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-12-21 16:18:28 +01:00

[CL-104] fix overlay + virtual scroll view recycling bug (#6179)

* close menu overlay when no longer visible

* prevent infinite loop in fallback-src directive

* block scrolling when menu is open

* disable view recycling; use reposition strategy
This commit is contained in:
Will Martin 2023-10-12 10:34:53 -04:00 committed by GitHub
parent 7cfa38e344
commit 84bafe5e73
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 2 deletions

View File

@ -58,7 +58,7 @@
</tr>
</ng-container>
<ng-template body let-rows$>
<ng-container *cdkVirtualFor="let item of rows$">
<ng-container *cdkVirtualFor="let item of rows$; templateCacheSize: 0">
<tr
*ngIf="item.collection"
bitRow

View File

@ -6,9 +6,15 @@ import { Directive, ElementRef, HostListener, Input } from "@angular/core";
export class FallbackSrcDirective {
@Input("appFallbackSrc") appFallbackSrc: string;
/** Only try setting the fallback once. This prevents an infinite loop if the fallback itself is missing. */
private tryFallback = true;
constructor(private el: ElementRef) {}
@HostListener("error") onError() {
this.el.nativeElement.src = this.appFallbackSrc;
if (this.tryFallback) {
this.el.nativeElement.src = this.appFallbackSrc;
this.tryFallback = false;
}
}
}