You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on May 14, 2025. It is now read-only.
Is this considered fixed? I'm still experiencing inconsistent theme adherance.
What is the problem?
If the theme is toggled to light mode on a page without an interactive editor, subsequently navigating to a page with an interactive editor will display the editor in dark mode.
The reason for this is that we postMessage the new theme to all IEx iframes on the page whenever the theme changes, which in turn stores the theme in IEx localStorage (which is independent from MDN localStorage!). However, when the page has no IEx iframe, that message gets lost and the old theme is still stored in IEx localStorage.
A solution would be to have either IEx iframes "ask" their MDN parent for the current theme, or to have the MDN parent listen for IEx iframes using MutationObserver or similar and postMessage the current theme proactively.
Activity
schalkneethling commentedon Mar 15, 2022
Thank you, @pilchard. I have seen there are some edge cases where this is still problematic.
caugner commentedon May 3, 2022
The reason for this is that we
postMessage
the new theme to all IEx iframes on the page whenever the theme changes, which in turn stores the theme in IEx localStorage (which is independent from MDN localStorage!). However, when the page has no IEx iframe, that message gets lost and the old theme is still stored in IEx localStorage.A solution would be to have either IEx iframes "ask" their MDN parent for the current theme, or to have the MDN parent listen for IEx iframes using MutationObserver or similar and postMessage the current theme proactively.
caugner commentedon Mar 14, 2025
This should be resolved with migrating interactive examples inline, so we won't fix it in bob, which is in the process of being archived.