Skip to content

Commit 2872a35

Browse files
committed
docs: clarify comment
1 parent 4739503 commit 2872a35

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

packages/component-base/src/virtualizer-iron-list-adapter.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,10 @@ export class IronListAdapter {
5555
const attachObserver = new ResizeObserver(([{ contentRect }]) => {
5656
const isHidden = contentRect.width === 0 && contentRect.height === 0;
5757
if (!isHidden && this.__scrollTargetHidden && this.scrollTarget.scrollTop !== this._scrollPosition) {
58-
// Adjust scroll position after moving the element within DOM
59-
// while also making it visible (e.g. inside of the dialog).
58+
// When removing element from DOM, its scroll position is lost and
59+
// virtualizer doesn't re-render when adding it to the DOM again.
60+
// Restore scroll position when the scroll target becomes visible,
61+
// which is the case e.g. when virtualizer is used inside a dialog.
6062
this.scrollTarget.scrollTop = this._scrollPosition;
6163
}
6264

0 commit comments

Comments
 (0)