From cd48240d48cb11c7766b5d7850263e4e038d259e Mon Sep 17 00:00:00 2001 From: Nolann Biron Date: Thu, 28 May 2026 11:43:12 +0200 Subject: [PATCH] Fix OpenAPI code sample box not scrolling on initial load The relative wrapper around the pre in CodeBlockRenderer was a block flex item, so its min-height defaulted to its content size. The pre therefore never shrunk inside the sticky OpenAPI preview column, leaving content clipped by the parent's overflow-hidden without ever triggering the pre's own overflow-auto scroll. Make the wrapper a flex column with min-h-0 so the pre (as a scroll-container flex child) shrinks and scrolls correctly whenever the available height is smaller than its content. --- .changeset/perky-wings-help.md | 5 +++++ .../components/DocumentView/CodeBlock/CodeBlockRenderer.tsx | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .changeset/perky-wings-help.md diff --git a/.changeset/perky-wings-help.md b/.changeset/perky-wings-help.md new file mode 100644 index 0000000000..3b7147cbf1 --- /dev/null +++ b/.changeset/perky-wings-help.md @@ -0,0 +1,5 @@ +--- +"gitbook": patch +--- + +Fix OpenAPI CodeBlock scroll diff --git a/packages/gitbook/src/components/DocumentView/CodeBlock/CodeBlockRenderer.tsx b/packages/gitbook/src/components/DocumentView/CodeBlock/CodeBlockRenderer.tsx index 80447664a0..3b48e39844 100644 --- a/packages/gitbook/src/components/DocumentView/CodeBlock/CodeBlockRenderer.tsx +++ b/packages/gitbook/src/components/DocumentView/CodeBlock/CodeBlockRenderer.tsx @@ -63,7 +63,7 @@ export const CodeBlockRenderer = forwardRef(function CodeBlockRenderer( ) : null} -
+