Skip to content

fix!: change css class for disabled block pattern#8864

Merged
maribethb merged 1 commit intoRaspberryPiFoundation:rc/v12.0.0from
maribethb:disabled-css
Apr 8, 2025
Merged

fix!: change css class for disabled block pattern#8864
maribethb merged 1 commit intoRaspberryPiFoundation:rc/v12.0.0from
maribethb:disabled-css

Conversation

@maribethb
Copy link
Contributor

The basics

The details

Resolves

Fixes #8857

Proposed Changes

Moves the disabled pattern css into a separate class. The blocklyDisabled class doesn't contain any styling now by default.

Reason for Changes

Not everyone wants to use the disabled pattern for their disabled blocks. They can't just skip adding the blocklyDisabled class because we use that for other things like adding other styles or not during a drag for example. Now if they don't want it, they can override updateDisabled_ in their custom path object and apply blocklyDisabled but not blocklyDisabledPattern.

Breaking Changes

If you do not override PathObject in a custom renderer, this change does not affect you and you do not need to take any action. This change only affects you if you override PathObject.updateDisabled_ and you do not call super.

If you want the appearance of disabled blocks to remain the default, and you override this method, either call super or be sure to add/remove the blocklyDisabledPattern as needed.

If you do not want the appearance of blocks to remain the default, and you had previously overridden updateDisabled_ to ensure this, then you can continue to do so and be sure not to apply the blocklyDisabledPattern class. Do apply the blocklyDisabled class to continue getting other effects for disabled blocks like not showing the outline on when you hover a field on a disabled block.

@maribethb maribethb requested a review from a team as a code owner April 5, 2025 02:23
@maribethb maribethb requested a review from BenHenning April 5, 2025 02:23
@maribethb maribethb added breaking change Used to mark a PR or issue that changes our public APIs. PR: fix Fixes a bug labels Apr 5, 2025
Copy link
Collaborator

@BenHenning BenHenning left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The solution makes sense! I'm not 100% keen on the blocklyDisabled vs. blocklyDisabledPattern naming (just adding 'pattern' doesn't add a lot of context), but I have no concerns with this PR since it's already an established name through the variable and existing code.

That being said, perhaps something like blocklyDisabledStyle would be clearer? It'd help to also rename blockDisabled to something like blocklyDisabledState to further distinguish, but that's presumably a much more impacting change than this.

@maribethb
Copy link
Contributor Author

The solution makes sense! I'm not 100% keen on the blocklyDisabled vs. blocklyDisabledPattern naming (just adding 'pattern' doesn't add a lot of context), but I have no concerns with this PR since it's already an established name through the variable and existing code.

That being said, perhaps something like blocklyDisabledStyle would be clearer? It'd help to also rename blockDisabled to something like blocklyDisabledState to further distinguish, but that's presumably a much more impacting change than this.

I think pattern is more clear than style since everything is a style in a css class, but pattern refers to the css variable of the same name that adds the grid pattern fill. And yeah, changing the name of blocklyDisabled would be too disruptive since that is a preexisting class name people may be relying on. Thanks for the review!

@maribethb maribethb merged commit 2c05119 into RaspberryPiFoundation:rc/v12.0.0 Apr 8, 2025
8 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking change Used to mark a PR or issue that changes our public APIs. PR: fix Fixes a bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants