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

fix: fix bug that resulted in a variable dialog appearing atop the procedure editor dialog on mobile #26

Merged
merged 1 commit into from
Sep 18, 2024

Conversation

gonfunko
Copy link
Owner

This PR fixes gonfunko/scratch-blocks#169. Scratch doesn't use modal inputs on mobile like Blockly core does, but because this functionality wasn't being suppressed with the appropriate injection option, when the procedure editor modal was displayed, the default block, which has an editable text field, became focused, and on mobile caused a call to prompt(), resulting in the secondary dialog.

@rachel-fenichel
Copy link
Collaborator

Added google/blockly#8580 to document this option, since I was surprised to find it has no documentation.

I don't actually understand hwo this fixes the underlying problem. Why does the variable modal pop up from the procedure block?

@gonfunko
Copy link
Owner Author

Screenshot 2024-09-18 at 11 59 02 AM When the Make a Block button is clicked to open the procedure editor, the starting block has the "block name" field which automatically gets focus. Without this change, on mobile, Blockly displays a modal dialog using `prompt()` to allow you to change the value of that field. Note that it isn't actually a variable dialog; Scratch swaps out the prompt implementation for one that looks at various passed-in fields, and depending upon the title configures the prompt for adding variables, lists, etc. The logic is such that it defaults to the "New Variable" title and the for this sprite/for all sprites option, but this is just a plain old prompt to modally edit a field value - note the "Change value" label for the text field, which is the only bit that actually does get passed into the prompt call.

@rachel-fenichel
Copy link
Collaborator

Note that it isn't actually a variable dialog; Scratch swaps out the prompt implementation

Got it, this was the piece I was missing.

@gonfunko gonfunko merged commit 8b1bf24 into modern-blockly Sep 18, 2024
@gonfunko gonfunko deleted the mobile-modals branch September 18, 2024 19:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Clicking on "make a block" opens up Variable creation dialog box on top of block creation box in iPad device
2 participants