Skip to content

Commit 5c82fe2

Browse files
committed
Update scroll height again
1 parent 3017782 commit 5c82fe2

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

js/dataframe/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -374,11 +374,11 @@ const ShinyDataGrid: FC<ShinyDataGridProps<unknown>> = (props) => {
374374
const headerRowCount = table.getHeaderGroups().length;
375375

376376
// Assume we're scrolling until proven otherwise
377-
let scrollingClass = "";
377+
let scrollingClass = rowData.length > 0 ? "scrolling" : "";
378378
const scrollHeight = containerRef.current?.scrollHeight;
379379
const clientHeight = containerRef.current?.clientHeight;
380-
if (scrollHeight && clientHeight && scrollHeight > clientHeight) {
381-
scrollingClass = "scrolling";
380+
if (scrollHeight && clientHeight && scrollHeight <= clientHeight) {
381+
scrollingClass = "";
382382
}
383383

384384
const makeHeaderKeyDown =

js/dataframe/styles.scss

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@ shiny-data-frame {
5151

5252
.shiny-data-grid {
5353
max-width: 100%;
54-
height: 500px;
55-
&:not(.scrolling) {
56-
height: auto;
54+
height: auto;
55+
&.scrolling {
56+
height: 500px;
5757
}
5858

5959
> table {

0 commit comments

Comments
 (0)