fix(embedded-sdk): add accessible title to iframe (#27017)
Co-authored-by: Maxime Beauchemin <maximebeauchemin@gmail.com>
This commit is contained in:
parent
725375541d
commit
1a52c6a3b8
|
|
@ -60,6 +60,8 @@ export type EmbedDashboardParams = {
|
||||||
dashboardUiConfig?: UiConfigType
|
dashboardUiConfig?: UiConfigType
|
||||||
/** Are we in debug mode? */
|
/** Are we in debug mode? */
|
||||||
debug?: boolean
|
debug?: boolean
|
||||||
|
/** The iframe title attribute */
|
||||||
|
iframeTitle?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export type Size = {
|
export type Size = {
|
||||||
|
|
@ -82,7 +84,8 @@ export async function embedDashboard({
|
||||||
mountPoint,
|
mountPoint,
|
||||||
fetchGuestToken,
|
fetchGuestToken,
|
||||||
dashboardUiConfig,
|
dashboardUiConfig,
|
||||||
debug = false
|
debug = false,
|
||||||
|
iframeTitle = "Embedded Dashboard",
|
||||||
}: EmbedDashboardParams): Promise<EmbeddedDashboard> {
|
}: EmbedDashboardParams): Promise<EmbeddedDashboard> {
|
||||||
function log(...info: unknown[]) {
|
function log(...info: unknown[]) {
|
||||||
if (debug) {
|
if (debug) {
|
||||||
|
|
@ -156,8 +159,8 @@ export async function embedDashboard({
|
||||||
// return our port from the promise
|
// return our port from the promise
|
||||||
resolve(new Switchboard({ port: ourPort, name: 'superset-embedded-sdk', debug }));
|
resolve(new Switchboard({ port: ourPort, name: 'superset-embedded-sdk', debug }));
|
||||||
});
|
});
|
||||||
|
|
||||||
iframe.src = `${supersetDomain}/embedded/${id}${urlParamsString}`;
|
iframe.src = `${supersetDomain}/embedded/${id}${urlParamsString}`;
|
||||||
|
iframe.title = iframeTitle;
|
||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
mountPoint.replaceChildren(iframe);
|
mountPoint.replaceChildren(iframe);
|
||||||
log('placed the iframe')
|
log('placed the iframe')
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue