From b6fcbd79fb6b5d6cce537fe7e973f78cacce630f Mon Sep 17 00:00:00 2001 From: Robert Knight Date: Tue, 9 Nov 2021 11:58:43 +0000 Subject: [PATCH] Add note about limitations of scroll container size change detection The window `resize` event is good enough for the current use case and works in all browsers, but wouldn't work if the ThreadList could change size independently of the iframe/window. --- src/sidebar/components/ThreadList.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/sidebar/components/ThreadList.js b/src/sidebar/components/ThreadList.js index 9e1e9f35ece..4f6ddbf2755 100644 --- a/src/sidebar/components/ThreadList.js +++ b/src/sidebar/components/ThreadList.js @@ -73,6 +73,10 @@ function ThreadList({ threads }) { ); listeners.add(scrollContainer, 'scroll', updateScrollPosition); + + // We currently assume that the scroll container's size only changes with + // the window as a whole. A more general approach would involve using + // ResizeObserver via the `observeElementSize` utility. listeners.add(window, 'resize', updateScrollPosition); return () => {