Skip to content

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

fix(embed-js): Fix EAJS children with ExplicitSize not scaling down (#66821)

Mahatthana (Kelvin) Nomsawadif473c192b9c5
diff --git a/e2e/test/scenarios/embedding/sdk-iframe-embedding-setup/select-embed-options.cy.spec.ts b/e2e/test/scenarios/embedding/sdk-iframe-embedding-setup/select-embed-options.cy.spec.ts
index a9cfb38de13..5996fe405a7 100644
--- a/e2e/test/scenarios/embedding/sdk-iframe-embedding-setup/select-embed-options.cy.spec.ts
+++ b/e2e/test/scenarios/embedding/sdk-iframe-embedding-setup/select-embed-options.cy.spec.ts
@@ -254,6 +254,23 @@ describe(suiteTitle, () => {
cy.findByRole("heading", { name: "Email this dashboard" }).should(
"be.visible",
);
+
+ /**
+ * It seems `should("be.visible")` above doesn't not work in iframe.
+ * It can only check the existence of the element but not its visibility.
+ */
+ cy.findByTestId("dashboard").then(($dashboard) => {
+ const EXPECTED_APPROX_WIDTH = 800;
+ const ERROR_TOLERANCE = 50;
+ const dashboardWidth = $dashboard.width();
+ expect(
+ dashboardWidth,
+ "EAJS preview should scale when opening a dashboard sidebar (EMB-1120)",
+ ).to.be.within(
+ EXPECTED_APPROX_WIDTH - ERROR_TOLERANCE,
+ EXPECTED_APPROX_WIDTH + ERROR_TOLERANCE,
+ );
+ });
});
getEmbedSidebar()
diff --git a/frontend/src/embedding-sdk-bundle/components/private/PublicComponentStylesWrapper.style.css b/frontend/src/embedding-sdk-bundle/components/private/PublicComponentStylesWrapper.style.css
index fe2f5da64dc..33c13510d47 100644
--- a/frontend/src/embedding-sdk-bundle/components/private/PublicComponentStylesWrapper.style.css
+++ b/frontend/src/embedding-sdk-bundle/components/private/PublicComponentStylesWrapper.style.css
@@ -3,6 +3,8 @@
all: initial;
text-decoration: none;
font-style: normal;
+ /* Fix the issue with ExplicitSize not resizing when this container is wrapped in a grid container */
+ min-width: 0;
width: 100%;
height: 100%;
font-weight: 400;