Skip to content

The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:

Remove redundant scrollbars when previewing new questions in Documents (#83719)

Anderson97e4b02dc39a
diff --git a/frontend/src/metabase/documents/components/editor-extensions/CardEmbed/modals/CreateStructuredQuestionModal.module.css b/frontend/src/metabase/documents/components/editor-extensions/CardEmbed/modals/CreateStructuredQuestionModal.module.css
index 1abd12bc835..4297590679f 100644
--- a/frontend/src/metabase/documents/components/editor-extensions/CardEmbed/modals/CreateStructuredQuestionModal.module.css
+++ b/frontend/src/metabase/documents/components/editor-extensions/CardEmbed/modals/CreateStructuredQuestionModal.module.css
@@ -1,3 +1,17 @@
+.modalContent,
+.modalBody {
+ display: flex;
+ flex-direction: column;
+}
+
+.modalContent {
+ overflow: hidden;
+}
+
+.modalBody {
+ min-height: 0;
+}
+
.notebookContainer {
overflow: auto;
}
diff --git a/frontend/src/metabase/documents/components/editor-extensions/CardEmbed/modals/CreateStructuredQuestionModal.tsx b/frontend/src/metabase/documents/components/editor-extensions/CardEmbed/modals/CreateStructuredQuestionModal.tsx
index dfcf180a2d7..824e4dc1103 100644
--- a/frontend/src/metabase/documents/components/editor-extensions/CardEmbed/modals/CreateStructuredQuestionModal.tsx
+++ b/frontend/src/metabase/documents/components/editor-extensions/CardEmbed/modals/CreateStructuredQuestionModal.tsx
@@ -112,6 +112,7 @@ export const CreateStructuredQuestionModal = ({
size="80%"
title={t`Create new question`}
padding="xl"
+ classNames={{ content: S.modalContent, body: S.modalBody }}
>
<Box h="70vh" className={S.notebookContainer}>
<Notebook
diff --git a/frontend/src/metabase/querying/notebook/components/NotebookStep/NotebookStepPreview/NotebookStepPreview.tsx b/frontend/src/metabase/querying/notebook/components/NotebookStep/NotebookStepPreview/NotebookStepPreview.tsx
index a286389f107..82b66406c81 100644
--- a/frontend/src/metabase/querying/notebook/components/NotebookStep/NotebookStepPreview/NotebookStepPreview.tsx
+++ b/frontend/src/metabase/querying/notebook/components/NotebookStep/NotebookStepPreview/NotebookStepPreview.tsx
@@ -4,7 +4,9 @@ import { t } from "ttag";
import { getErrorMessage } from "metabase/api/utils";
import CS from "metabase/css/core/index.css";
+import { HEADER_HEIGHT, ROW_HEIGHT } from "metabase/data-grid/constants";
import { Box, Button, Flex, Icon } from "metabase/ui";
+import { getScrollBarSize } from "metabase/utils/dom";
import { checkNotNull } from "metabase/utils/types";
import Visualization from "metabase/visualizations/components/Visualization";
import * as Lib from "metabase-lib";
@@ -139,5 +141,5 @@ export const VisualizationPreview = ({
function getPreviewHeightForResult(result: Dataset | null) {
const rowCount = result ? result.data.rows.length : 1;
- return rowCount * 36 + 36 + 2;
+ return rowCount * ROW_HEIGHT + HEADER_HEIGHT + getScrollBarSize() + 2;
}