From 1a52c6a3b84e1e5cde5d57ea4166816a9bcc51d6 Mon Sep 17 00:00:00 2001 From: bhaugeea <99675156+bhaugeea@users.noreply.github.com> Date: Tue, 4 Jun 2024 17:51:14 -0500 Subject: [PATCH] fix(embedded-sdk): add accessible title to iframe (#27017) Co-authored-by: Maxime Beauchemin --- superset-embedded-sdk/src/index.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/superset-embedded-sdk/src/index.ts b/superset-embedded-sdk/src/index.ts index 4cbcb74ae..09814f760 100644 --- a/superset-embedded-sdk/src/index.ts +++ b/superset-embedded-sdk/src/index.ts @@ -60,6 +60,8 @@ export type EmbedDashboardParams = { dashboardUiConfig?: UiConfigType /** Are we in debug mode? */ debug?: boolean + /** The iframe title attribute */ + iframeTitle?: string } export type Size = { @@ -82,7 +84,8 @@ export async function embedDashboard({ mountPoint, fetchGuestToken, dashboardUiConfig, - debug = false + debug = false, + iframeTitle = "Embedded Dashboard", }: EmbedDashboardParams): Promise { function log(...info: unknown[]) { if (debug) { @@ -156,8 +159,8 @@ export async function embedDashboard({ // return our port from the promise resolve(new Switchboard({ port: ourPort, name: 'superset-embedded-sdk', debug })); }); - iframe.src = `${supersetDomain}/embedded/${id}${urlParamsString}`; + iframe.title = iframeTitle; //@ts-ignore mountPoint.replaceChildren(iframe); log('placed the iframe')