scratchfoundation / scratchfoundation/scratch-blocks

Creating a custom procedure with % in the title collapses blocks pallet

Open
#2,107 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

High Severity Low Prevalence priority 3
Dominant language
JavaScript
Stars
2.8k
Forks
1.6k
Avg merge
4h 51m
Merged PRs (30d)
12

Description

Expected Behavior

Creating a block with a percent (%) symbol as the first character, such as "% [text or number input]" or with just the title "% asdf" it should create a block with that name.

Actual Behavior

When create a block with a text input as the first element and you make that text input start with a % sign it causes a number of problems.

First, if you add another element, the block shows up as blank in the Make a Block modal.
Screen Shot 2020-09-08 at 11 38 30 AM

Second, if you click OK nothing appears to happen. The modal does not close. Then if you close the modal, either by clicking off of it or clicking the x, the modal closes, but the block does not appear in the blocks workspace. Additionally, all of the blocks in the blocks Pallet become stacked on top of each other (scrolled all the way to the top.)
Screen Shot 2020-09-08 at 11 25 10 AM

It does not matter what the rest of the string in that initial text input is. If it is just a % symbol it does not show the first behavior until you add another element, such as a second text input, or a boolean input, etc.

This only the first text input that shows this bug. So if you add % signs to the start of other text inputs it works fine. You can also start a variable input with a % as the first element in the block and it will work fine (remove the initial text input.)

Also, if you click cancel after you get a blank block in the modal it does not rearrange the blocks in the block pallet.

Steps to Reproduce

Create a new project
Make a Block
In the first text input type any string that starts with a %
Click the modal so that it removes focus from that text input
note: the text appears on the block preview as expected
Add another element such as another text input
Note: Everything disappears from the block preview, showing a blank block
Click OK
Note: the modal does not close
Close the modal (click off the modal or click the x on the modal)
Note: All of the blocks in the blocks pallet are stacked on top of one another at the top of the pallet

Operating System and Browser

Mac Chrome

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue in the Make a Block modal using a first text input beginning with %, then trace how the block preview and blocks pallet are updated when another element is added. Done means the modal remains usable, the custom block is created, and the blocks pallet keeps its layout after confirming or cancelling.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.