elements
elements copied to clipboard
vscode-table does not always scroll hidden content [bug]
The table scrolling is not always activated, even when tabel content is partially hidden.
Proposed fix
// Line 201 - vscode-table.js
_resizeTableBody() {
let headerHeight = 0;
let tbodyHeight = 0;
const tableHeight = this.getBoundingClientRect().height;
if (this._assignedHeaderElements && this._assignedHeaderElements.length) {
headerHeight =
this._assignedHeaderElements[0].getBoundingClientRect().height;
}
if (this._assignedBodyElements && this._assignedBodyElements.length) {
// Fix: scrollHeight gives natural content size vs constrained getBoundingClientRect
tbodyHeight = this._assignedBodyElements[0].scrollHeight;
}
const availableContentHeight = Math.max(0, tableHeight - headerHeight);
// Fix: was tbodyHeight - headerHeight - tableHeight > 0 (problem calculation)
const needsScrolling = tbodyHeight > availableContentHeight;
this._scrollableElement.style.height =
needsScrolling ? `${availableContentHeight}px` : 'auto';
}
Thanks for the report!
Could you make me a minimal reproducible example? https://github.com/vscode-elements/elements/blob/main/CONTRIBUTING.md
Is it possible that this error appeared with the latest version? I fixed a bug related to the Scrollable component.