refactor!: Move responsibility for block creation out of flyouts#9610
Merged
refactor!: Move responsibility for block creation out of flyouts#9610
Conversation
Contributor
Author
maribethb
reviewed
Mar 4, 2026
maribethb
approved these changes
Mar 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The basics
The details
Proposed Changes
This PR moves block creation out of the flyout and into the
BlockDragStrategy. This simplifies the code overall and results in a better separation of concerns: flyouts are capable of holding arbitrary kinds of objects now, so having them tightly coupled to blocks is suboptimal. Now, duplicating blocks when dragged out of the flyout is handled by theBlockDragStrategy, and the flyout is concerned only with the display and layout of its contents, whatever they may be. As a result of this change, it's now possible to copy blocks out of the flyout using the keyboard alone by selecting a block in the flyout and hittingmto enter move mode, which copies the block to the main workspace and puts it in move mode, exactly the same as a mouse-driven drag would.Breaking Changes
createBlock(),isDragTowardWorkspace(), andisBlockCreatable()have been removed fromIFlyout. While this is not breaking from a building standpoint, it is behaviorally breaking if you have an alternate flyout implementation that customized those methods.isDragTowardWorkspace()was already a no-op, so no action needs to be taken other than removing it. Customizations that were made tocreateBlock()andisBlockCreatable()can be achieved by creating aBlockDragStrategysubclass that overridesisMovable()and/orswapTargetBlock()and using a mixin or extension to apply that drag strategy to your blocks.