Skip to content

Commit beddde5

Browse files
Fix bug where Gallery scrollbar would not show up (#11938)
1 parent b4984cc commit beddde5

File tree

3 files changed

+19
-4
lines changed

3 files changed

+19
-4
lines changed

.changeset/bitter-glasses-send.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"@gradio/gallery": patch
3+
"gradio": patch
4+
---
5+
6+
fix:Fix bug where Gallery scrollbar would not show up

js/gallery/Gallery.stories.svelte

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
defaultValue: 2
3535
},
3636
height: {
37-
options: ["auto", 500, 600],
37+
options: ["auto", 200, 500, 600],
3838
description: "The height of the grid",
3939
control: { type: "select" },
4040
defaultValue: "auto"
@@ -258,7 +258,16 @@
258258
height: 400
259259
}}
260260
/>
261-
261+
<Story
262+
name="Gallery with overflow of images and short height"
263+
args={{
264+
label: "My Cheetah Gallery",
265+
show_label: true,
266+
rows: 2,
267+
columns: 2,
268+
height: 200
269+
}}
270+
/>
262271
<Story
263272
name="Gallery with download button"
264273
args={{

js/gallery/shared/Gallery.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -461,6 +461,7 @@
461461
class:minimal={mode === "minimal"}
462462
class:fixed-height={mode !== "minimal" && (!height || height == "auto")}
463463
class:hidden={is_full_screen}
464+
style:height={height !== "auto" ? height + "px" : null}
464465
>
465466
{#if interactive && selected_index === null}
466467
<ModifyUpload {i18n} on:clear={() => (value = [])}>
@@ -484,7 +485,7 @@
484485
{/if}
485486
<div
486487
class="grid-container"
487-
style="--grid-cols:{effective_columns}; --grid-rows:{rows}; --object-fit: {object_fit}; height: {height};"
488+
style="--grid-cols:{effective_columns}; --grid-rows:{rows}; --object-fit: {object_fit};"
488489
class:pt-6={show_label}
489490
>
490491
{#each resolved_value as entry, i}
@@ -722,7 +723,6 @@
722723
.grid-wrap {
723724
position: relative;
724725
padding: var(--size-2);
725-
height: var(--size-full);
726726
overflow-y: scroll;
727727
}
728728

0 commit comments

Comments
 (0)