Skip to content

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

Fix scrolling in the static embedding modal (#84089)

Andrei Chernykh8cf927e83a2e
diff --git a/frontend/src/metabase/embedding/components/EmbedModal/EmbedModal.module.css b/frontend/src/metabase/embedding/components/EmbedModal/EmbedModal.module.css
index 37ef14252f8..716855b95c7 100644
--- a/frontend/src/metabase/embedding/components/EmbedModal/EmbedModal.module.css
+++ b/frontend/src/metabase/embedding/components/EmbedModal/EmbedModal.module.css
@@ -3,3 +3,18 @@
border-bottom: 1px solid var(--mb-color-border-neutral);
}
+
+/* As tall as the viewport allows, so the header stays put and the columns below scroll on their own */
+.content {
+ display: flex;
+ flex-direction: column;
+ height: min(60rem, calc(100dvh - var(--modal-y-offset) * 2));
+ overflow: hidden;
+}
+
+.body {
+ display: flex;
+ flex-direction: column;
+ flex: 1 1 auto;
+ min-height: 0;
+}
diff --git a/frontend/src/metabase/embedding/components/EmbedModal/EmbedModal.tsx b/frontend/src/metabase/embedding/components/EmbedModal/EmbedModal.tsx
index cf59c4306b4..987329070a6 100644
--- a/frontend/src/metabase/embedding/components/EmbedModal/EmbedModal.tsx
+++ b/frontend/src/metabase/embedding/components/EmbedModal/EmbedModal.tsx
@@ -40,6 +40,7 @@ export const EmbedModal = ({
size="auto"
withCloseButton={false}
padding={0}
+ classNames={{ content: S.content, body: S.body }}
>
<ModalHeader
py="xl"
diff --git a/frontend/src/metabase/embedding/components/EmbedModal/StaticEmbedSetupPane/SettingsTabLayout.tsx b/frontend/src/metabase/embedding/components/EmbedModal/StaticEmbedSetupPane/SettingsTabLayout.tsx
index ee742cc3a29..46672a7405a 100644
--- a/frontend/src/metabase/embedding/components/EmbedModal/StaticEmbedSetupPane/SettingsTabLayout.tsx
+++ b/frontend/src/metabase/embedding/components/EmbedModal/StaticEmbedSetupPane/SettingsTabLayout.tsx
@@ -16,18 +16,18 @@ export const SettingsTabLayout = ({
previewSlot,
}: SettingsTabLayoutProps): JSX.Element => {
return (
- <Flex>
+ <Flex flex="1 1 auto" mih={0}>
<Box
className={cx(S.borderRight, CS.overflowYAuto)}
flex="0 0 auto"
w="21.6rem"
- h="45.125rem"
p="xxl"
bg="background_page-primary"
>
{settingsSlot}
</Box>
<Stack
+ className={CS.overflowYAuto}
w="100%"
miw="50rem"
pos="relative"
diff --git a/frontend/src/metabase/embedding/components/EmbedModal/StaticEmbedSetupPane/StaticEmbedSetupPane.module.css b/frontend/src/metabase/embedding/components/EmbedModal/StaticEmbedSetupPane/StaticEmbedSetupPane.module.css
new file mode 100644
index 00000000000..c97806a517a
--- /dev/null
+++ b/frontend/src/metabase/embedding/components/EmbedModal/StaticEmbedSetupPane/StaticEmbedSetupPane.module.css
@@ -0,0 +1,16 @@
+/* The status bar and tab strip stay put; the columns of the tab content scroll on their own */
+.tabs {
+ display: flex;
+ flex-direction: column;
+ flex: 1 1 auto;
+ min-height: 0;
+}
+
+.tabPanel {
+ display: flex;
+ flex-direction: column;
+ flex: 1 1 auto;
+ min-height: 0;
+ overflow-x: auto;
+ overflow-y: hidden;
+}
diff --git a/frontend/src/metabase/embedding/components/EmbedModal/StaticEmbedSetupPane/StaticEmbedSetupPane.tsx b/frontend/src/metabase/embedding/components/EmbedModal/StaticEmbedSetupPane/StaticEmbedSetupPane.tsx
index 4b1a3096021..3e85d01b14e 100644
--- a/frontend/src/metabase/embedding/components/EmbedModal/StaticEmbedSetupPane/StaticEmbedSetupPane.tsx
+++ b/frontend/src/metabase/embedding/components/EmbedModal/StaticEmbedSetupPane/StaticEmbedSetupPane.tsx
@@ -32,6 +32,7 @@ import { PreviewModeSelector } from "./PreviewModeSelector";
import { type PreviewBackgroundType, PreviewPane } from "./PreviewPane";
import { ServerEmbedCodePane } from "./ServerEmbedCodePane";
import { SettingsTabLayout } from "./SettingsTabLayout";
+import S from "./StaticEmbedSetupPane.module.css";
import { getDefaultDisplayOptions } from "./config";
import { getDefaultEmbeddingParams } from "./lib/get-default-embedding-params";
import { getHasParamsChanged } from "./lib/get-has-params-changed";
@@ -208,7 +209,7 @@ export const StaticEmbedSetupPane = ({
>(EMBED_MODAL_TABS.Overview);
return (
- <Stack gap={0}>
+ <Stack gap={0} flex="1 1 auto" mih={0}>
<Paper withBorder shadow="sm" m="1.5rem 2rem" p="0.75rem 1rem">
<EmbedModalContentStatusBar
resourceType={resourceType}
@@ -221,6 +222,7 @@ export const StaticEmbedSetupPane = ({
</Paper>
<Tabs
+ className={S.tabs}
defaultValue={EMBED_MODAL_TABS.Overview}
data-testid="embedding-preview"
>
@@ -251,7 +253,7 @@ export const StaticEmbedSetupPane = ({
* when you change to a different tab since they're all rendered inside
* different `Tabs.Panel` if you were to use it as Mantine suggests.
*/}
- <Tabs.Panel value={activeTab}>
+ <Tabs.Panel className={S.tabPanel} value={activeTab}>
{activeTab === EMBED_MODAL_TABS.Overview ? (
<OverviewSettings
resourceType={resourceType}