diff --git a/src/__stories__/JsonSchemaViewer.tsx b/src/__stories__/JsonSchemaViewer.tsx index 36c72d8c..4b058463 100644 --- a/src/__stories__/JsonSchemaViewer.tsx +++ b/src/__stories__/JsonSchemaViewer.tsx @@ -140,7 +140,8 @@ storiesOf('JsonSchemaViewer', module) ); - }); + }) + .add('maxHeight', () => ); storiesOf('JsonSchemaViewer/combiners', module) .addDecorator(withKnobs) diff --git a/src/__stories__/_styles.scss b/src/__stories__/_styles.scss index 7c005172..fca4c61b 100644 --- a/src/__stories__/_styles.scss +++ b/src/__stories__/_styles.scss @@ -2,8 +2,7 @@ @import '~@stoplight/mosaic/themes/default.css'; .JsonSchemaViewer { - margin: auto; + margin: 20px auto; width: 100%; - padding: 20px; max-width: 800px; } diff --git a/src/hooks/useIsOnScreen.ts b/src/hooks/useIsOnScreen.ts index 629f5338..1ac0fde3 100644 --- a/src/hooks/useIsOnScreen.ts +++ b/src/hooks/useIsOnScreen.ts @@ -34,7 +34,7 @@ function getScrollParent(node: HTMLElement | null): HTMLElement | typeof window return null; } - if (node.scrollHeight > node.clientHeight) { + if (node.scrollHeight > node.clientHeight && node.clientHeight > 0) { return node.tagName === 'HTML' ? window : node; } else { return getScrollParent(node.parentElement);