dosubot[bot] commented on issue #40522: URL: https://github.com/apache/superset/issues/40522#issuecomment-4574118539
<!-- Answer --> This is a known limitation of the embedded SDK — there's currently **no programmatic API to switch dashboard tabs after the iframe loads**. The communication between the parent and embedded iframe uses a MessageChannel/MessagePort protocol (not raw `postMessage`), which is why your approach #3 didn't work [[1]](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset-embedded-sdk/src/index.ts) [[2]](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset-frontend/src/embedded/index.tsx). Here's why each approach fails and what you can try: **Why `urlParams: { anchor: 'TAB-xxxx' }` doesn't work:** Anchor links were intentionally removed from embedded dashboards in v5.0.0. A [fix was introduced in PR #36924](https://github.com/apache/superset/pull/36924) that re-adds anchor scrolling support in embedded mode, but this targets scroll positioning rather than full tab switching [[3]](https://github.com/apache/superset/pull/36924) [[4]](https://github.com/apache/superset/issues/36132#issuecomment-3540828227). **Why `postMessage` doesn't work:** The SDK doesn't use raw `window.postMessage` for communication. It uses a `Switchboard` abstraction over `MessageChannel`/`MessagePort`, with a specific handshake protocol using `"__embedded_comms__"` messages [[5]](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset-frontend/packages/superset-ui-switchboard/src/switchboard.ts). The available methods (`getActiveTabs`, `getDashboardPermalink`, etc.) are read-only — there is no `setActiveTab` method exposed [[6]](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset-frontend/src/embedded/index.tsx#L228-L260). **Possible workarounds:** 1. **Use `permalink_key` in `urlParams`** — Generate a permalink that includes the target tab's state via the `/api/v1/dashboard/{id}/permalink` endpoint, then pass it as `urlParams: { permalink_key: "KEY" }`. This visually selects the tab, though there's a reported bug where content may still show the first tab [[4]](https://github.com/apache/superset/issues/36132#issuecomment-3540828227). 2. **Separate embedded dashboards per "view"** — Instead of tabs, create separate dashboards for each section and embed the appropriate one based on button clicks in your parent app. 3. **Manually manipulate the iframe URL** — From the parent app, update the iframe `src` to append `#TAB-xxxx` as a hash. This requires re-rendering the iframe, which loses state but does navigate to the correct tab. 4. **Embed individual charts** — If tabs represent distinct chart groups, consider embedding individual charts rather than the full dashboard. None of these are ideal. Extending the Switchboard protocol to include a `setActiveTab` method would be the proper solution but would require a code contribution to the project. <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot?utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=reply-with-mention&utm_term=apache%2Fsuperset).* --- Docs are dead. Just use [Dosu](https://dosu.dev?utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=static-docs-tagline&utm_term=apache%2Fsuperset). [](https://app.dosu.dev/response-feedback?utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=static-docs-feedback&utm_term=apache%2Fsuperset&message_id=7df6e7b5-9d39-43fa-a1ea-89604ba3b019) [](https://github.dosu.com/apache/superset?utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=static-docs-ask-repo&utm_term=apache%2Fsuperset) [](https://app.dosu.dev/signup?referrer=openSource&source=github-footer&utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=static-docs-share-team&utm_term=apache%2Fsuperset) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
