microsoft / pxt-microbit

A Blocks / JavaScript code editor for the micro:bit built on Microsoft MakeCode
https://makecode.microbit.org
Other
713 stars 589 forks source link

Language and high contrast tools menu options broken in iframe controller mode for beta editor #5209

Closed microbit-matt-hillsdon closed 1 year ago

microbit-matt-hillsdon commented 1 year ago

Describe the bug The language and high contrast settings menu options are broken in iframe controller mode in the beta editor only. I suspect you would also see these issues in the tutorial tool if you switched over to the beta editor.

The language dialog works as normal but doesn't actually change language.

The high contrast menu item doesn't seem to do anything at all.

We use the iframe controller mode in micro:bit classroom and trigger high contrast mode via the "togglehighcontrast" postMessage action which is broken in the same way. We don't use the language menu but the tutorial tool does and other folks embedding MakeCode might also do so.

Perhaps related to changes around login / preference storing?

To Reproduce Steps to reproduce the behavior:

  1. Go to https://kgi6qz.csb.app/ which embeds beta MakeCode via iframe controller mode. Any other test environment for iframe/controller mode should work, we're not doing anything special to trigger this.
  2. Enable high contrast mode and note nothing happens
  3. Change language and note the language doesn't actually change

Sandbox URL: https://codesandbox.io/s/wispy-dust-kgi6qz?file=/src/index.js (note that the embedded browser doesn't work well because of nested iframes)

Expected behavior If you flip the iframe URL in the sandbox back to live MakeCode then these features work as I'd expect.

Screenshots N/A

micro:bit version (please complete the following information):

N/A

Desktop (please complete the following information):

MakeCode version details

makecode.microbit.org version: 5.1.34

Microsoft MakeCode version: 8.6.47

microbit runtime version: v2.2.0-rc6

codal-microbit-v2 runtime version: v0.2.54

microbit-matt-hillsdon commented 1 year ago

Thanks for the fix. I've confirmed the high contrast option is working again in micro:bit classroom when tested with the micro:bit MakeCode beta.