Skip to content

Commit 30e45fa

Browse files
authored
fix(Giphy): use fixed height for giphy preview to prevent layout shifts (#3095)
## Summary - Set a fixed height (`--str-chat__gif-height`: 200px) on the giphy container during the preview/shuffle state - Prevents layout jumps when shuffling between portrait and landscape giphies - Keeps the Shuffle/Send/Cancel action buttons visible without scrolling - Add fixed dimensions to the giphy image placeholder so the layout is stable when a giphy fails to load - Removed stale TODO comment that this change resolves ## Test plan - [ ] Type `/giphy <query>` to trigger a giphy preview - [ ] Click Shuffle repeatedly — verify the container height stays stable and action buttons remain visible - [ ] Verify both portrait and landscape giphies render properly within the fixed height via `object-fit: contain` - [ ] After sending, verify the giphy renders at full dynamic height (no fixed constraint) - [ ] Simulate a giphy image load failure — verify the placeholder has correct dimensions
1 parent b5cb01f commit 30e45fa

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

src/components/Attachment/styling/Giphy.scss

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
}
77

88
.str-chat__message-attachment-giphy {
9-
// todo: maybe we do not want to restrict the height
10-
//height: var(--str-chat__gif-height);
119
position: relative;
1210
display: flex;
1311
align-items: center;
@@ -26,6 +24,11 @@
2624
width: 100%;
2725
cursor: default;
2826
}
27+
28+
.str-chat__image-placeholder {
29+
height: var(--str-chat__gif-height);
30+
width: var(--str-chat__attachment-max-width);
31+
}
2932
}
3033

3134
.str-chat__giphy-badge {
@@ -50,6 +53,14 @@
5053
}
5154

5255
.str-chat__message-attachment--giphy--actions {
56+
.str-chat__message-attachment-giphy {
57+
height: var(--str-chat__gif-height);
58+
59+
img.str-chat__base-image {
60+
height: var(--str-chat__gif-height);
61+
}
62+
}
63+
5364
.str-chat__visibility-disclaimer {
5465
display: flex;
5566
padding: var(--spacing-sm, 12px);

0 commit comments

Comments
 (0)