google / blockly

The web-based visual programming editor.
https://developers.google.com/blockly/
Apache License 2.0
12.51k stars 3.72k forks source link

fix: Fix crash when resizing page while editing a field. #8646

Closed gonfunko closed 1 week ago

gonfunko commented 2 weeks ago

The basics

The details

Resolves

Fixes #7809

Proposed Changes

This PR fixes a crash that could occur when the window was resized while a field has focus/is being edited. Calling moveBy on a child block is invalid, but because FieldInput was bumping its parent block (potentially nested) during resizes, that invalid code path could be triggered. Instead, the root block of the FieldInput will be bumped into bounds if needed, which is safe. resizeEditor_() was also updated to wait for the active render to complete, since it needs to know the bounds of its parent block, which was causing rendering glitches.