Skip to content

Cherry pick keyboardcontrols=1 flag to stable12.0#11206

Merged
abchatra merged 2 commits into
microsoft:stable12.0from
microbit-matt-hillsdon:keyboardcontrols-flag-stable
Mar 26, 2026
Merged

Cherry pick keyboardcontrols=1 flag to stable12.0#11206
abchatra merged 2 commits into
microsoft:stable12.0from
microbit-matt-hillsdon:keyboardcontrols-flag-stable

Conversation

@microbit-matt-hillsdon
Copy link
Copy Markdown
Contributor

@microbit-matt-hillsdon microbit-matt-hillsdon commented Mar 20, 2026

This cherry picks #11185 and the follow-up tidy up #11198 so that we can use the flag in CreateAI against live MakeCode.

In order for me to test this with pxt-microbit stable8.0 I found I needed @riknoll's microsoft/pxt-microbit#6706 (I think it was needed due to a types release on npm) but I think best for you to check and port that if needed.

CC @abchatra.

microbit-matt-hillsdon and others added 2 commits March 20, 2026 12:12
…oft#11185)

* Add keyboardcontrols=1 flag to enable testing "on by default"

This is a temporary flag to enable trialing enabling keyboard controls by
default. Micro:bit Educational Foundation are going to do that in their tools
that embed MakeCode and provide feedback. This might then be a route to simply
enabling them in the next release.

I've implemented this by flipping the default based on the flag.

Now that the user isn't naturally exposed to the help by enabling keyboard
controls, we show the same help toast as Blockly when the workspace is focused
from the skip link. It might be nice to do this in other scenarios (e.g. first
tab to the workspace) but that is a riskier change.

There are still some arguable downsides from this flag that we might want to
address before making it the default:

- It enables "passive focus" dashed outline around blocks. The purpose of this
  is to remind the user of the workspace context (which is where e.g. a toolbox
  block insert will be relative to). But this is more relevant to keyboard
  users. Passive focus is enabled based on Blocky's logic about whether
  keyboard navigation has been used which can be a bit hard to predict as a
  user.

- The active area indicator for the workspace (black focus ring) is also shown
  for all users. When a user clicks on the workspace background we also
  indicate that the workspace itself has focus via the yellow ring (as per
  blocks). We have in the past proposed making this conditional on
  keyboard navigation being in use (so it feels like focus-visible CSS).

Both intentionally unaddressed for now so we can:

1. reduce risk of this change, which is needed in live MakeCode
2. gather feedback specifically from folks who notice these changes

Another aspect we intend to monitor is feedback from folks who might
unintentionally trigger shortcuts.

For telemetry I've intentionally not triggered an event from the default
setting and I've tagged the event source for subsequent changes with the fact
it was on by default.

* keyboardcontrols=1 flag tweaks based on PR feedback:

- use defaultOn as a telemetry dimension
- use BrowserUtils.isMac()

---------

Co-authored-by: Richard Knoll <riknoll@users.noreply.github.com>
…rosoft#11198)

This should have been part of microsoft#11185 to fully address the feedback (I added the
dimension but didn't remove this alternative approach).

Co-authored-by: Richard Knoll <riknoll@users.noreply.github.com>
@microbit-matt-hillsdon
Copy link
Copy Markdown
Contributor Author

Hi @abchatra, just a reminder that we're waiting on getting this in live MakeCode to start the experiment with the flag in CreateAI. Thanks.

@abchatra abchatra requested review from Copilot and riknoll and removed request for Copilot March 24, 2026 17:00
@abchatra
Copy link
Copy Markdown
Collaborator

@riknoll can you review this. This is port + hotfix.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Cherry-picks the keyboardcontrols=1 URL flag behavior into stable12.0 so keyboard controls (accessible blocks) can be enabled-by-default for embedded/testing scenarios, and adds a one-time hint toast to help users discover the keyboard help shortcut when that default is applied.

Changes:

  • Add core.isKeyboardControlsByDefault() helper to detect keyboardcontrols=1 in the URL.
  • Default accessibleBlocks/keyboard controls to “on” at preference read time when the flag is present, and add a telemetry dimension (defaultOn) when toggling.
  • Add a pending “keyboard controls help” toast flow when opening Blocks via the accessibility entry point; update openBlocks typing/signature.

Reviewed changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
webapp/src/core.ts Adds URL-flag helper for default keyboard controls behavior.
webapp/src/auth.ts Uses URL flag as default when no stored/persisted setting exists; adds telemetry dimension.
webapp/src/blocks.tsx Introduces pending hint flag and displays a one-time help toast when focusing the workspace.
webapp/src/app.tsx Extends openBlocks() to optionally request showing the keyboard controls hint.
webapp/src/accessibility.tsx Passes the flag-derived default into openBlocks() from accessibility entry point.
pxtlib/auth.ts Changes default user prefs factory to leave accessibleBlocks unset so it can be defaulted at read time.
localtypings/pxteditor.d.ts Updates IProjectView.openBlocks() signature to match new optional parameter.

Comment thread webapp/src/app.tsx
@abchatra
Copy link
Copy Markdown
Collaborator

@microbit-matt-hillsdon can you look at the copilot review comment and see if it makes sense or not? Let me know if I can merge once you address it.

@abchatra abchatra merged commit 0dddb6c into microsoft:stable12.0 Mar 26, 2026
13 checks passed
@microbit-matt-hillsdon
Copy link
Copy Markdown
Contributor Author

I think the next steps are to release pxt from stable12.0, upgrade pxt in pxt-microbit, then release. I don't think I can help with this part @abchatra. Please would you tag me and @microbit-robert when this is done so we can update CreateAI. Thanks.

@abchatra
Copy link
Copy Markdown
Collaborator

We have bumped makecode.microbit.org/stable and final build is available here
image

Let me know if you want to give a quick test on your setup to ensure it didn't regress other scenarios. Once confirmed we will release it right away.

@microbit-matt-hillsdon
Copy link
Copy Markdown
Contributor Author

Thanks @abchatra, /stable looks good to us.

@microbit-matt-hillsdon
Copy link
Copy Markdown
Contributor Author

Thanks @abchatra, /stable looks good to us.

@abchatra, it would be great to update live to match stable for the start of the UK day tomorrow (I still see 8.0.18).

@abchatra
Copy link
Copy Markdown
Collaborator

abchatra commented Apr 2, 2026

@microbit-matt-hillsdon this is shipped. Sorry for the delay it is one of those weeks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants