Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
This repository was archived by the owner on May 7, 2026. It is now read-only.

Commit a634e97

Browse filesBrowse files
authored
feat: Stabilize interactive table height to prevent notebook layout shifts (#2378)
This update introduces a new feature in the interactive table display that prevents notebook layout shifts when changing the number of rows per page. The table height is now intelligently set and fixed after its initial display, creating a more stable and predictable user experience. Verified at: vs code notebook: https://screencast.googleplex.com/cast/NTY2NjM1NDQwNDI2MTg4OHwzNDEwZTA5Zi0wOA Fixes #<460861785> 🦕
1 parent 798af4a commit a634e97
Copy full SHA for a634e97

3 files changed

+468-128Lines changed: 468 additions & 128 deletions

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎bigframes/display/table_widget.js‎

Copy file name to clipboardExpand all lines: bigframes/display/table_widget.js
+18Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,9 +170,27 @@ function render({ model, el }) {
170170
model.save_changes();
171171
}
172172

173+
let isHeightInitialized = false;
174+
173175
function handleTableHTMLChange() {
174176
tableContainer.innerHTML = model.get(ModelProperty.TABLE_HTML);
175177

178+
// After the first render, dynamically set the container height to fit the
179+
// initial page (usually 10 rows) and then lock it.
180+
setTimeout(() => {
181+
if (!isHeightInitialized) {
182+
const table = tableContainer.querySelector('table');
183+
if (table) {
184+
const tableHeight = table.offsetHeight;
185+
// Add a small buffer(e.g. 2px) for borders to avoid scrollbars.
186+
if (tableHeight > 0) {
187+
tableContainer.style.height = `${tableHeight + 2}px`;
188+
isHeightInitialized = true;
189+
}
190+
}
191+
}
192+
}, 0);
193+
176194
const sortableColumns = model.get(ModelProperty.ORDERABLE_COLUMNS);
177195
const currentSortContext = model.get(ModelProperty.SORT_CONTEXT) || [];
178196

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.