Skip to content

Update to Blockly 13 - #4069

Merged
jisqyv merged 42 commits into
mit-cml:masterfrom
mjgallag:update-to-blockly-13
Oct 28, 2026
Merged

jisqyv merged 42 commits into
mit-cml:masterfrom
mjgallag:update-to-blockly-13

Conversation

@mjgallag

@mjgallag mjgallag commented Aug 15, 2026 •

Copy link
Copy Markdown
Contributor

What does this PR accomplish?

Description

What does this PR accomplish?

josmas/blockly-plugins#6
mit-cml/blockly-plugins#88
mit-cml/workspace-multiselect#154

I had to map all of the single letter shortcuts due to typeblocking. I went with option/alt as it seemed to lack system conflicts.
Note the Blockly keyboard shortcut help dialog we had in 12 is not in 13 as Blockly did not move it into core from https://github.com/raspberrypifoundation/blockly-keyboard-experimentation.

Context for the changes

If this PR changes anything related to the companion make sure you have used the ucr branch. For all other changes use master or provide context for having used a different branch.
See a summary of git branches in the docs: App Inventor Developer Overview

If your code changes how something works on the device (i.e., it affects the companion):

  • I have made no changes that affect the companion

  • I branched from ucr

  • My pull request has ucr as the base

Further, if you've changed the blocks language or another user-facing designer/blocks API (added a SimpleProperty, etc.):

  • I have updated the corresponding version number in appinventor/components/src/.../common/YaVersion.java
  • I have updated the corresponding upgrader in appinventor/appengine/src/.../client/youngandroid/YoungAndroidFormUpgrader.java (components only)
  • I have updated the corresponding entries in appinventor/blocklyeditor/src/versioning.js

For all other changes:

  • I have made no changes that affect the master branch

  • I branched from master

  • My pull request has master as the base

General items:

  • I have updated the relevant documentation files under docs/
  • My code follows the:
  • ant tests passes on my machine

@mjgallag
mjgallag marked this pull request as ready for review August 15, 2026 00:28
@mjgallag
mjgallag requested a review from a team August 15, 2026 00:28
@ewpatton

Copy link
Copy Markdown
Member

@mjgallag I'm marking this as for-ai2-test so we can get some additional eyes on the update.

@mjgallag

Copy link
Copy Markdown
Contributor Author

@ewpatton Sounds good, that'll get more eyes on it then throwing my test instance out there. FYI @jisqyv I'm going to update it to https://github.com/RaspberryPiFoundation/blockly/releases/tag/blockly-v13.3.0 today as might as well do that before it goes to ai2-test.

Stage the BlocklyPanel element in a hidden div before initializing the workspace.
GWT later moves it into the ProjectEditor deck when the editor is added.
Blockly measures a hidden workspace using computed CSS, which requires
the workspace element to be attached to the document.
RaspberryPiFoundation/blockly#8572
Removes staging of BlocklyPanel element in a hidden div before initializing the workspace workaround.
@mjgallag
mjgallag force-pushed the update-to-blockly-13 branch from 367f7da to d11f73c Compare September 15, 2026 15:16
@ewpatton

ewpatton commented Oct 26, 2026 •

Copy link
Copy Markdown
Member

Ok, so I noticed this the other day when using ai2-test, but it turns out to be an issue in prod as well. For certain height windows, the backpack icon ends up being at a significant offset from the top of the Blackly panel. This technically isn't a blocker for this PR since it happens in prod, but we should look into it.

Screenshot 2026-10-26 at 01 42 03

Making the window ~40 px bigger or smaller (vertically) seems to resolve the issue.

@ewpatton ewpatton mentioned this pull request Oct 26, 2026
5 of 12 tasks
@ewpatton

Copy link
Copy Markdown
Member

I also note that the Flydown parameters are black, as is the flydown background. It also doesn't dismiss after the block is dragged out like in previous versions.

Screenshot 2026-10-26 at 08 47 38

@jisqyv

jisqyv commented Oct 26, 2026 •

Copy link
Copy Markdown
Member

@ewpatton I'm not seeing things as black... (I'm not in dark mode)
block

@ewpatton ewpatton added this to the nb207 milestone Oct 26, 2026
@mjgallag mjgallag mentioned this pull request Oct 26, 2026
8 of 17 tasks
@@ -0,0 +1,57 @@
import type { FlyoutItem } from '../flyout_item.js';

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Interestingly, this file doesn't include a copyright / license header?

@@ -0,0 +1,151 @@
import type { IDraggable } from '../interfaces/i_draggable.js';

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Another .d.ts file lacking documentation.

@@ -0,0 +1,26 @@
import type { IBoundedElement } from './interfaces/i_bounded_element.js';

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Another one.

BlockSelectorBox.getBlockSelectorBox().addBlockDrawerSelectionListener(this);

designer = (T) projectEditor.getFileEditor(blocksNode.getEntityName(), DesignerEditor.EDITOR_TYPE);
formToBlocksEditor.put(entityName, this);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don't understand why we need to delay setting up the mapping until after load. Can you clarify why this is needed? It is true here as well as being true inLoad, so delaying it seems like it could only introduce problems.

}

@Override
protected void onWorkspaceInitialized() {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

For sanity's sake, we should still call super despite it currently being a no-op, in case in the future we do add onWorkspaceInitialized behavior in the parent in the future. GWT will optimize it out for now.

Comment on lines +618 to 624
int pos = Collections.binarySearch(fileIds, newBlocksEditor.getFileId(),
getFileIdComparator());
if (pos < 0) {
pos = -pos - 1;
}
insertFileEditor(newBlocksEditor, pos);
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Likely something to defer given how old this code is, but given that ProjectEditor has knowledge of fileIds, I wonder why we don't just move the logic of finding the position, etc. into insertFileEditor rather than having the subclass do the work.

String fileId = fileEditor.getFileId();
openFileEditors.put(fileId, fileEditor);
fileIds.add(beforeIndex, fileId);
fileIds.add(beforeIndex, fileEditor.getFileId());

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

See my comments on YaProjectEditor about insert/open files and how we handle the responsibility of these things.

@ewpatton ewpatton left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I am approving this but I did leave a bunch of minor comments for us to think about.

@ewpatton

ewpatton commented Oct 28, 2026 •

Copy link
Copy Markdown
Member

@ewpatton I'm not seeing things as black... (I'm not in dark mode) block

@jisqyv @mjgallag
I just tried again with ai2-test and ai2a in both Firefox and Chrome with the devtools open to the network panel with Disable Cache and was able to replicate my experience from earlier.

On ai2a, I see the following CSS rule:

geras2_renderer-renderer.classic-theme .blocklyFieldParameter > rect {
  fill: rgb(222, 143, 108);
  fill-opacity: 1.0;
  stroke-width: 2;
  stroke: rgb(231, 175, 150);
}

but I see no similar application on ai2-test.

@ewpatton

Copy link
Copy Markdown
Member

I should also note that this is marked as an inline rule, so it's being injected by something, presumably the lexical variable plugin given the context.

@mjgallag

Copy link
Copy Markdown
Contributor Author

@ewpatton your picture isn’t loading.

@ewpatton

Copy link
Copy Markdown
Member

@mjgallag It's a quoted picture from Jeff's earlier comment.

Regardless, what I'm (not) seeing is the injected stylesheet for geras2 from the lexvar plugin (I think). I see that the injection div has the right class (i.e., .geras2_renderer-renderer) but there doesn't seem to be CSS associated with that.

@ewpatton

Copy link
Copy Markdown
Member

Never mind. It appears to be a dark mode bug. After switching ai2a to dark mode I have replicated the problem in prod.

@ewpatton

Copy link
Copy Markdown
Member

So to summarize, in light mode I see the light orange in both ai2a and ai2-test, but when I switch to dark mode the parameters/flydowns end up with a black background. I'd suggest filing this as an issue and accepting the PR as is.

@jisqyv
jisqyv merged commit bc660a3 into mit-cml:master Oct 28, 2026
@mjgallag
mjgallag deleted the update-to-blockly-13 branch October 28, 2026 14:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants