Skip to content

Commit

Permalink
fix: workaround an IE11 bug
Browse files Browse the repository at this point in the history
  • Loading branch information
tomivirkki committed Dec 16, 2021
1 parent c6cd586 commit 5edc53c
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions src/vaadin-grid-drag-and-drop-mixin.html
Original file line number Diff line number Diff line change
Expand Up @@ -303,13 +303,17 @@

/** @private */
__getViewportRows() {
const headerBottom = this.$.header.getBoundingClientRect().bottom;
const footerTop = this.$.footer.getBoundingClientRect().top;
return Array.from(this.$.items.children)
.filter(row => {
const rowRect = row.getBoundingClientRect();
return rowRect.bottom > headerBottom && rowRect.top < footerTop;
});
// Workaround an IE11 bug where the `getBoundingClientRect` for header/footer
// might return incorrect values
this.$.header.style.outline = '0px solid transparent';
const scrollerRect = this.$.scroller.getBoundingClientRect();
const headerBottom = Math.max(this.$.header.getBoundingClientRect().bottom, scrollerRect.top);
const footerTop = Math.min(this.$.footer.getBoundingClientRect().top, scrollerRect.bottom);

return Array.from(this.$.items.children).filter((row) => {
const rowRect = row.getBoundingClientRect();
return rowRect.bottom > headerBottom && rowRect.top < footerTop;
});
}

/** @protected */
Expand Down

0 comments on commit 5edc53c

Please # to comment.