-
Notifications
You must be signed in to change notification settings - Fork 13.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(embedded-sdk): add accessible title to iframe #27017
Changes from 3 commits
765e809
7a41939
fed7303
dee2eee
7de23d2
fdefa2b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,7 @@ import { | |
DASHBOARD_UI_FILTER_CONFIG_URL_PARAM_KEY, | ||
IFRAME_COMMS_MESSAGE_TYPE | ||
} from './const'; | ||
import { t } from '@superset-ui/core'; | ||
|
||
// We can swap this out for the actual switchboard package once it gets published | ||
import { Switchboard } from '@superset-ui/switchboard'; | ||
|
@@ -51,6 +52,8 @@ export type EmbedDashboardParams = { | |
supersetDomain: string | ||
/** The html element within which to mount the iframe */ | ||
mountPoint: HTMLElement | ||
/** The iframe title attribute */ | ||
iframeTitle?: string | ||
/** A function to fetch a guest token from the Host App's backend server */ | ||
fetchGuestToken: GuestTokenFetchFn | ||
/** The dashboard UI config: hideTitle, hideTab, hideChartControls, filters.visible, filters.expanded **/ | ||
|
@@ -77,6 +80,7 @@ export async function embedDashboard({ | |
id, | ||
supersetDomain, | ||
mountPoint, | ||
iframeTitle = t("Embedded Dashboard"), | ||
fetchGuestToken, | ||
dashboardUiConfig, | ||
debug = false | ||
|
@@ -154,6 +158,9 @@ export async function embedDashboard({ | |
}); | ||
|
||
iframe.src = `${supersetDomain}/embedded/${id}${dashboardConfig}${filterConfigUrlParams}`; | ||
if(iframeTitle) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think given the default value set in the function header, this will always have a value, so no |
||
iframe.title = iframeTitle; | ||
} | ||
//@ts-ignore | ||
mountPoint.replaceChildren(iframe); | ||
log('placed the iframe') | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey this look like a public interface, so this new [optional] param should be the last one in the function call for backwards compatibility, otherwise we'l have off-by-one param matching on the function call!