Let ListWidget's reveal take no action if the revealed element is already overflowing the viewport

Fix #78237
This commit is contained in:
Rob Lourens 2019-10-18 17:03:28 -07:00
parent a9640d05a2
commit dfaff021a8

View file

@ -1533,7 +1533,9 @@ export class List<T> implements ISpliceable<T>, IDisposable {
const viewItemBottom = elementTop + elementHeight;
const wrapperBottom = scrollTop + this.view.renderHeight;
if (elementTop < scrollTop) {
if (elementTop < scrollTop && viewItemBottom >= wrapperBottom) {
// The element is already overflowing the viewport, no-op
} else if (elementTop < scrollTop) {
this.view.setScrollTop(elementTop);
} else if (viewItemBottom >= wrapperBottom) {
this.view.setScrollTop(viewItemBottom - this.view.renderHeight);