Skip to content
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

Interactive examples are sometimes still not adhering to the current theme #734

Open
schalkneethling opened this issue Mar 15, 2022 · 2 comments
Labels
dark-mode effort: medium This task is a medium effort. interactive-examples p3 We don't have visibility when this will be addressed. redesign

Comments

@schalkneethling
Copy link

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.

Steps to reproduce the issue

  1. With dark mode toggle on navigate to a page without an Interactive Editor (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/@@iterator)
  2. Toggle light mode on
  3. Navigate to a page with an Interactive Editor (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/concat)

5454

Environment

Device

Desktop

Browsers

Firefox: 98.0.1 (64-bit)
Chrome: Version 99.0.4844.51 (Official Build) (x86_64)
Brave: Version 1.36.112 Chromium: 99.0.4844.51 (Official Build) (x86_64)
Safari: Version 15.3 (17612.4.9.1.8)

Operating system

Mac OS: 12.2.1

Originally posted by @pilchard in mdn/yari#5428 (comment)

@github-actions github-actions bot added the needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened. label Mar 15, 2022
@schalkneethling
Copy link
Author

Thank you, @pilchard. I have seen there are some edge cases where this is still problematic.

@schalkneethling schalkneethling transferred this issue from mdn/yari Mar 15, 2022
@schalkneethling schalkneethling removed the needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened. label Mar 15, 2022
@caugner
Copy link
Contributor

caugner commented 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 caugner added effort: medium This task is a medium effort. p3 We don't have visibility when this will be addressed. labels Jun 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dark-mode effort: medium This task is a medium effort. interactive-examples p3 We don't have visibility when this will be addressed. redesign
Projects
Development

No branches or pull requests

2 participants