Skip to content

Commit

Permalink
fix(embedded-sdk): add accessible title to iframe (apache#27017)
Browse files Browse the repository at this point in the history
Co-authored-by: Maxime Beauchemin <[email protected]>
  • Loading branch information
bhaugeea and mistercrunch authored Jun 4, 2024
1 parent 7253755 commit 1a52c6a
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions superset-embedded-sdk/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand All @@ -82,7 +84,8 @@ export async function embedDashboard({
mountPoint,
fetchGuestToken,
dashboardUiConfig,
debug = false
debug = false,
iframeTitle = "Embedded Dashboard",
}: EmbedDashboardParams): Promise<EmbeddedDashboard> {
function log(...info: unknown[]) {
if (debug) {
Expand Down Expand Up @@ -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')
Expand Down

0 comments on commit 1a52c6a

Please sign in to comment.