Skip to content

Conversation

@rpbourret
Copy link
Collaborator

The basics

The details

Resolves

v12 made two major changes to context menus:

  • Added a focusedNode property to the scope argument
  • Added support for separators

The codelab also was inconsistent in its use of the terms item/registry item (the thing in the registry) and menu option (the thing in the context menu).

Proposed Changes

In the codelab doc:

  • Remove scopeType and replace uses of scopeType with scope.focusedNode
  • Remove the section Scope/Block scope; restricting menu options to blocks is now illustrated in the Precondition: Node type section.
  • Add a section on Separators
  • Clarify/clean up uses of the terms item and option.
  • Minor formatting cleanup. (Copied code is now indented properly for pasting.)

In the codelab code:

  • Update starter-code/index.js and complete-code/index.js accordingly.

Reason for Changes

Current codelab is not up to date.

Test Coverage

Tested by hand.

Documentation

PR includes documentation fixes.

Additional Information

@rpbourret rpbourret requested a review from a team as a code owner October 23, 2025 19:02
@rpbourret rpbourret requested review from maribethb and removed request for a team October 23, 2025 19:02
Copy link
Contributor

@maribethb maribethb left a comment

Choose a reason for hiding this comment

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

Mostly some suggestions you should feel free to push back on, but you will have to decide one way or the other about the workspace comment bit.

Copy link
Contributor

@maribethb maribethb left a comment

Choose a reason for hiding this comment

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

LGTM with minor wording quibble

};
```

Notice that the code tests for where context menus are allowed, rather than where they are not allowed. This is because custom code (such as a plugin) can add context menus to any Blockly component that can be focused. Thus, testing for what something isn't may result in allowing context menus on more components than you anticipated.
Copy link
Contributor

Choose a reason for hiding this comment

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

Thus, testing for what something isn't

How about... Thus, testing for specific types rather than allowing all (or all but certain types) will ensure that context menus are not shown on more components than you anticipated.

I'm not sure if that's actually better. If you don't like that, maybe putting isn't in italics would help make it read the appropriate emphasis?

@rpbourret rpbourret merged commit eacbc11 into RaspberryPiFoundation:master Oct 24, 2025
8 checks passed
@rpbourret rpbourret deleted the contextmenu2 branch October 27, 2025 16:40
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.

2 participants