blockly: Shadow block dropdown gets color of parent category
Check for duplicates
- I have searched for similar issues before opening a new one.
Description
If a shadow block has a dropdown, it gets the color of the parent category, instead of the color of the block own category.
Reproduction steps
- Run
npm run startand click theAdvanced playgroundlink to go to the advanced playground… - Load the following JSON into the playground:
{
"blocks": {
"languageVersion": 0,
"blocks": [
{
"type": "controls_whileUntil",
"inputs": {
"BOOL": {
"shadow": {
"type": "logic_boolean"
}
}
}
}
]
}
}
- Click on the dropdown block.
- Observe how the dropdown has the color of the parent.
Stack trace
No response
Screenshots
Tested on https://www.supercodingball.com/code/offline/do-nothing:
https://github.com/google/blockly/assets/7261426/6300537c-7df8-453a-89aa-c71378838339
Browsers
Chrome desktop
To Fix
- Run the reproduction steps to make sure you can reproduce the problem.
- Modify the
showEditor_method in theFieldDropdownto always show the current block color (instead of showing the parent colour when the block is a shadow). - Rerun the reproduction steps and make sure you can’t reproduce the problem…
About this issue
- Original URL
- State: closed
- Created 10 months ago
- Comments: 27 (18 by maintainers)
Commits related to this issue
- Fix: #7416 — committed to Apoorvgarg-creator/blockly by Apoorvgarg-creator 8 months ago
- Fix: #7416 (#7628) — committed to google/blockly by Apoorvgarg-creator 8 months ago
- Blockly 10.3 (fixes https://github.com/google/blockly/issues/7416) — committed to Orange-OpenSource/super-coding-ball by clementcontet 7 months ago
Sorry should have clarified, this is a zelos-specific issue, so you need to switch to the zelos renderer. It’s in the right side bar under “Options”
Hey, Thanks a lot ! @BeksOmega, One more question, I read the conversation, and I believe if I do this, this will solve the issue Modify the showEditor_ method in the FieldDropdown to always show the current block color (instead of showing the parent colour when the block is a shadow).
Ok I added fix instructions to this issue so that dropdowns will always match the color of the given block.
And I separated out the shadow blocks matching parents question into a separate issue: https://github.com/google/blockly/issues/7607
TL:DR, I don’t really like the idea of adding another constant, because I think it breaks separation of responsibility and isn’t super sustainable. I think we should see if we can migrate to using CSS for themes if possible, but I still need to dig into this.
Right, the dropdown should match the shadow block in both cases.
The proposal above to introduce
SHADOW_BLOCKS_USE_PARENT_STYLE = falseas a renderer constant applies to the whole block including its dropdown (and so could be considered separately from this issue since it requires bigger changes).