microsoft / microsoft/pxt-microbit
Boolean variable should be made consistent in look and behaviour
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 804
- Forks
- 721
- Avg merge
- 2d 9h
- Merged PRs (30d)
- 2
Description
** Is your feature request related to a problem? Please describe.
The look of boolean variables are not consistent. For example condition fields are pointy ended boxes which fit the defined 'true' and 'false' constants. This can be confusing to the user. The current situation and a proposed solution is outlined below.
**The problem and a possible solution
When a variable is assigned to a boolean value, as in the 'on start' function, the editor clearly knows that it is a boolean. This is reflected (as illustrated below) in the errors given when trying to set it to a number or as a parameter in the 'show number' function. However, the user is not given this feedback. For example, the boolean variable (roundy ends) can be inserted as a condition in the 'if statement' despite the fact that a boolean value (and corresponding field) is shown as a pointy ended box (see next image).

Pointy condition field.

The solution is to make boolean variables the correct shape to fit the boolean field, as below

The make variable panel needs changing otherwise it is inconsistent (as below). If 'bouncing' is a boolean then obviously it cannot be set to a number or changed by 1.

The revised (and consistent) variables panel would look like this.

Boolean variable are now consistent in 'fitting' boolean fields and not fitting non-boolean fields. As shown below, the user can easily see that the boolean variable 'bouncing' can be used as a condition.

Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the blocks editor's boolean variable rendering and the make-variable panel; no files or tests are identified in the issue. Done means boolean variables use the boolean shape consistently, fit condition fields, and are excluded from numeric operations and assignments.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- design, frontend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100