Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Block change events from boolean fields can't be grouped. #6456

Closed
johnnesky opened this issue Sep 29, 2022 · 0 comments · Fixed by #8589
Closed

Block change events from boolean fields can't be grouped. #6456

johnnesky opened this issue Sep 29, 2022 · 0 comments · Fixed by #8589
Labels
component: events component: fields issue: bug Describes why the code or behaviour is wrong

Comments

@johnnesky
Copy link
Member

johnnesky commented Sep 29, 2022

Describe the bug

It is not unusual for change listeners to attempt to create new events that are grouped with the event they are responding to. CONTROL_FLOW_IN_LOOP_CHECK_MIXIN.onChange does this, for example, and so does the shadow-block-converter plugin in: https://github.com/google/blockly-samples/blob/master/plugins/shadow-block-converter/src/shadow_block_converter.ts

However, I noticed while making the plugin that when editing a boolean field, the resulting block change event is assigned an empty string as the group name. This makes it impossible to group new events with this block change event (unless you retroactively overwrite the event's group name in the change listener).

In fact, I'm not sure why it would ever be desirable to have an ungroupable event. Why prevent grouping new events with an old event? Maybe every event should have a group name, even if only one event is in the group. I believe the same situation applies to dropdown fields too, and maybe other kinds of edit events.

To Reproduce

Navigate to: https://google.github.io/blockly-samples/plugins/shadow-block-converter/test/

Drag the controls_if block with shadowed children into the workspace, and edit one of the boolean fields on a shadowed block. The block will be automatically converted to a real block.

Try undoing the events. The block shadow change events will not be grouped with the boolean field change events. However, if you try this again with a different field type, the events will be properly grouped.

Expected behavior

Events created in response to boolean field change events should be able to be grouped with them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: events component: fields issue: bug Describes why the code or behaviour is wrong
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants