Skip to content

Commit 5eb8656

Browse files
committed
fix: detect when not scrolled at bottom
1 parent 2b0bd27 commit 5eb8656

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

electron/renderer/components/game-content/game-content.tsx

+13
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,18 @@ const emptyLogLine: GameLogLine = {
4444
*/
4545
const emptyLogLineRegex = /^(>?)(\n+)$/;
4646

47+
/**
48+
* For the 'scroll' event to fire on the element, the overflow
49+
* property must be set. We rely on this to know if the user has
50+
* scrolled to the bottom (and we should engage in auto-scrolling)
51+
* or if they have scrolled away from the bottom (and we should
52+
* not auto-scroll).
53+
*/
54+
const scrollablePanelStyles = css({
55+
overflowY: 'scroll',
56+
height: '100%',
57+
});
58+
4759
const filterDuplicateEmptyLines: rxjs.MonoTypeOperatorFunction<GameLogLine> = (
4860
observable: rxjs.Observable<GameLogLine>
4961
) => {
@@ -178,6 +190,7 @@ export const GameContent: React.FC<GameContentProps> = (
178190
return (
179191
<EuiPanel
180192
panelRef={scrollableRef}
193+
css={scrollablePanelStyles}
181194
paddingSize="none"
182195
hasBorder={false}
183196
hasShadow={false}

0 commit comments

Comments
 (0)