Skip to content

Fix iPad toolbox interactions; unify Monaco toolbox on the click path#11404

Open
microbit-matt-hillsdon wants to merge 1 commit into
microsoft:masterfrom
microbit-matt-hillsdon:ipad-toolbox-flyout-followups
Open

Fix iPad toolbox interactions; unify Monaco toolbox on the click path#11404
microbit-matt-hillsdon wants to merge 1 commit into
microsoft:masterfrom
microbit-matt-hillsdon:ipad-toolbox-flyout-followups

Conversation

@microbit-matt-hillsdon

@microbit-matt-hillsdon microbit-matt-hillsdon commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

The Monaco toolbox drove category selection from a pointerup handler with the trailing click swallowed, because the first toolbox tap after the editor's textarea had focus produced no synthesized click.

The category selection by id was broken by recent changes to the category ids to scope them by editor (#11382, breaking @srietkerk's fix for microsoft/pxt-microbit#6802 - sorry!). These are now correctly scoped in this PR.

But it turns out the missing first-tap click is an interaction of the pointerdown preventDefault and the manual tree focus() together; with both removed the click fires normally. So Monaco now activates on click like the blocks editor: handlePointerDownCapture only suppresses focus-driven selection for the gesture (no preventDefault, no focus steal), and the pointerup handler and click suppression are gone. Long-press text selection, previously suppressed by preventDefault, is handled with user-select: none on the tree. Both editors now share the click path and the toolbox code is simpler.

User-visible change (iPad Safari, Monaco alignments to Blocks behaviour):

  • Tapping a category, or the "...more" entry, opens its flyout. Previously these taps did nothing due to the id issue.
  • Tapping the Advanced (...) toggle expands/collapses once, instead of opening then immediately snapping shut.
  • Re-tapping an open category closes its flyout instead of reopening it.
  • Closing a subcategory's "...more" flyout keeps its parent category expanded and selected, instead of collapsing it and jumping the highlight to the next category.
  • Collapsing the Advanced section no longer jerks the whole toolbox up under the header.
  • Switching between categories swaps the flyout contents in place instead of the flyout visibly disappearing and reappearing.

Deployment to help with testing: https://ipad-toolbox-flyout-followup.review-pxt.pages.dev/

I've tested on Android + Safari, we also re-checked desktop + screen reader. Any other tablet testing much appreciated.

Fixes microsoft/pxt-microbit#6802 (again!)

The Monaco toolbox drove category selection from a pointerup handler with the
trailing click swallowed, because the first toolbox tap after the editor's
textarea had focus produced no synthesized click.

The category selection by id was broken by recent changes to the category ids
to scope them by editor. These are now correctly scoped.

But it turns out the missing first-tap click is an interaction of the
pointerdown preventDefault and the manual tree focus() together; with both
removed the click fires normally. So Monaco now activates on click like the
blocks editor: handlePointerDownCapture only suppresses focus-driven selection
for the gesture (no preventDefault, no focus steal), and the pointerup handler
and click suppression are gone. Long-press text selection, previously
suppressed by preventDefault, is handled with user-select: none on the tree.
Both editors now share the click path and the toolbox code is simpler.

User-visible change (iPad Safari, Monaco alignments to Blocks behaviour unless
noted):
- Tapping a category, or the "...more" entry, opens its flyout. Previously
  these taps did nothing due to the id issue.
- Tapping the Advanced (...) toggle expands/collapses once, instead of
  opening then immediately snapping shut.
- Re-tapping an open category closes its flyout instead of reopening it.
- Closing a subcategory's "...more" flyout keeps its parent category expanded
  and selected, instead of collapsing it and jumping the highlight to the next
  category.
- Collapsing the Advanced section no longer jerks the whole toolbox up under
  the header.
- Switching between categories swaps the flyout contents in place instead of
  the flyout visibly disappearing and reappearing.

@srietkerk srietkerk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This looks awesome, thank you so much!

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.

[iPad] “…more” toolbox category does not respond to taps in Python and JavaScript editors

2 participants