Skip to content

Commit

Permalink
docs: clarify comment
Browse files Browse the repository at this point in the history
  • Loading branch information
web-padawan committed Feb 10, 2025
1 parent e645e25 commit 0fb7bb7
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/component-base/src/virtualizer-iron-list-adapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,10 @@ export class IronListAdapter {
const attachObserver = new ResizeObserver(([{ contentRect }]) => {
const isHidden = contentRect.width === 0 && contentRect.height === 0;
if (!isHidden && this.__scrollTargetHidden && this.scrollTarget.scrollTop !== this._scrollPosition) {
// Adjust scroll position after moving the element within DOM
// while also making it visible (e.g. inside of the dialog).
// When removing element from DOM, its scroll position is lost and
// virtualizer doesn't re-render when adding it to the DOM again.
// Restore scroll position when the scroll target becomes visible,
// which is the case e.g. when virtualizer is used inside a dialog.
this.scrollTarget.scrollTop = this._scrollPosition;
}

Expand Down

0 comments on commit 0fb7bb7

Please sign in to comment.