Skip to content

Commit dddbaea

Browse files
authored
fix(app): refit the table height when a block above it or the fonts change, so the gap below stays one gutter (#70)
1 parent 49c36ef commit dddbaea

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

‎src/main.tsx‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3950,6 +3950,13 @@ function bindEvents(): void {
39503950
// Keep only the table scrolling: refit on viewport changes and whenever
39513951
// the content above the table (wrapping toolbar, panels) changes height.
39523952
window.addEventListener('resize', fitTableHeight);
3953+
window.addEventListener('load', fitTableHeight);
3954+
if (document.fonts && document.fonts.ready) void document.fonts.ready.then(fitTableHeight); // the first fit ran before the fonts were in
3955+
if (typeof ResizeObserver === 'function') {
3956+
// a block above the table that shrinks after the first fit does not change the page height (min-h-screen), only its own size tells
3957+
const above = new ResizeObserver(() => fitTableHeight());
3958+
document.querySelectorAll('main > *').forEach(child => { if (!child.contains(el.tableScroll)) above.observe(child, { box: 'border-box' }); });
3959+
}
39533960
if (typeof ResizeObserver === 'function') {
39543961
new ResizeObserver(() => fitTableHeight()).observe(document.body);
39553962
}

0 commit comments

Comments
 (0)