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

rename of function fails with minimap and a call function #2131

Closed
1 task done
koenvanwijk opened this issue Dec 30, 2023 · 3 comments · Fixed by google/blockly#8150
Closed
1 task done

rename of function fails with minimap and a call function #2131

koenvanwijk opened this issue Dec 30, 2023 · 3 comments · Fixed by google/blockly#8150
Assignees
Labels
type: bug Something isn't working

Comments

@koenvanwijk
Copy link

Check for duplicates

  • I have searched for similar issues before opening a new one.

Component

plugin minimap

Description

When I try to rename a function the focus is lost after the first letter and I am unable to rename the function

Reproduction steps

  1. Create a new function
  2. Create the caller block
  3. Try to rename the function

Stack trace

No response

Screenshots

minimap.rename.function.fails.mp4
@johnnesky
Copy link
Member

Copying my comments from: #2305

When a procedure name is edited, the call blocks are also renamed. The edits to the procedure name are correctly fired as intermediate events, but the change to the call block is fired as a block change event, which is causing the problem where you can't keep typing in the open field input widget.

Maybe the best option would be for the changes to the call block names to be fired as intermediate events as well, and then when the changes to the procedure block are confirmed with a block change event, then we should also fire block change events confirming the changes to the call blocks. Otherwise, every character entered in the procedure block field would result in change events (from the call blocks) which is what we were trying to avoid with the intermediate event feature.

I noticed that the same problem occurs when you rename an argument in the mutator panel.

@johnnesky
Copy link
Member

I have a change in progress that allows the user to freely edit the function name while a minimap and an associated call block are present.

However, renaming arguments in the mutator panel causes the same issue, and that's harder to fix. The call block needs to be updated whenever either the function name or parameters are changed. The name is represented on the call block as a field, and I can use the existing BlockFieldIntermediateChange event type to update it without causing the whole workspace to reset. However, the parameters are represented on the call block as a mutation, and we don't have any event classes handy that can fire mutation changes without causing the minimap to reset the workspace.

@johnnesky
Copy link
Member

Summarizing some discussion elsewhere: I assumed the underlying bug had something to do with plugins/workspace-minimap/src/focus_region.ts since the events are causing the field input to lose focus. But upon further inspection, this file doesn't actually manipulate browser focus. Instead, the problem occurs when the plugin calls this.minimapWorkspace.zoomToFit() which calls WorkspaceSvg.hideChaff() which calls the static class method WidgetDiv.hide() which unfocuses the name inputs because the input widget is shared between the main workspace and the minimap workspace.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants