Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 4 commits into from
Oct 12, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion libs/angular/src/directives/fallback-src.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
}
8 changes: 7 additions & 1 deletion libs/components/src/menu/menu-trigger-for.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,13 @@ export class MenuTriggerForDirective implements OnDestroy {
panelClass: "bit-menu-panel",
hasBackdrop: true,
backdropClass: "cdk-overlay-transparent-backdrop",
scrollStrategy: this.overlay.scrollStrategies.reposition(),
scrollStrategy: this.overlay.scrollStrategies.reposition({
/**
* Autoclosing is required to properly track position in virtual scroll viewports.
* @see https://bitwarden.atlassian.net/browse/CL-104
*/
autoClose: true,
Hinton marked this conversation as resolved.
Show resolved Hide resolved
}),
positionStrategy: this.overlay
.position()
.flexibleConnectedTo(this.elementRef)
Expand Down
Loading