Skip to content

Commit

Permalink
Add note about limitations of scroll container size change detection
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
robertknight authored and esanzgar committed Nov 9, 2021
1 parent cf11048 commit b6fcbd7
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/sidebar/components/ThreadList.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 () => {
Expand Down

0 comments on commit b6fcbd7

Please sign in to comment.