Skip to content

Commit 5faeeac

Browse files
authored
fix: compat with virtual scroll containers (#181)
1 parent 1453f28 commit 5faeeac

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

src/__stories__/JsonSchemaViewer.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,8 @@ storiesOf('JsonSchemaViewer', module)
140140
</Box>
141141
</InvertTheme>
142142
);
143-
});
143+
})
144+
.add('maxHeight', () => <JsonSchemaViewer schema={schema as JSONSchema4} maxHeight={number('maxHeight', 500)} />);
144145

145146
storiesOf('JsonSchemaViewer/combiners', module)
146147
.addDecorator(withKnobs)

src/__stories__/_styles.scss

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
@import '~@stoplight/mosaic/themes/default.css';
33

44
.JsonSchemaViewer {
5-
margin: auto;
5+
margin: 20px auto;
66
width: 100%;
7-
padding: 20px;
87
max-width: 800px;
98
}

src/hooks/useIsOnScreen.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ function getScrollParent(node: HTMLElement | null): HTMLElement | typeof window
3434
return null;
3535
}
3636

37-
if (node.scrollHeight > node.clientHeight) {
37+
if (node.scrollHeight > node.clientHeight && node.clientHeight > 0) {
3838
return node.tagName === 'HTML' ? window : node;
3939
} else {
4040
return getScrollParent(node.parentElement);

0 commit comments

Comments
 (0)