1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-20 10:13:31 +00:00

[CL-834] Use intersection observer to determine if content scrolls (#16099)

* use intersection observer to fix dynamic content load issue

* set up mock intersection observer

* Create reusable hasScrollable content util

* return null from resize to fix type error

* remove Observer mock

* return observable

* refactor util and remove resize

* use async pipe for observable in template

* remove comment left in error
This commit is contained in:
Bryan Cunningham
2025-09-12 12:05:28 -04:00
committed by GitHub
parent f20ed9f0e9
commit 279d16999a
5 changed files with 65 additions and 14 deletions

View File

@@ -0,0 +1,17 @@
import { Observable } from "rxjs";
/** IntersectionObserver Observable */
export const intersectionObserver$ = (
target: Element,
init: IntersectionObserverInit,
): Observable<IntersectionObserverEntry> => {
return new Observable((sub) => {
const io = new IntersectionObserver((entries) => {
for (const e of entries) {
sub.next(e);
}
}, init);
io.observe(target);
return () => io.disconnect();
});
};