Skip to content

Conversation

@ashishmohapatra240
Copy link
Contributor

Fixes #3368

Checkbox labels could only be clicked once, then stopped working because CheckboxId::new() generated random IDs on every layout update. It updated CheckboxInput widgets with new IDs but skipped updating TextLabel widgets.

I added CheckboxId::from_string() to generate stable, hash-based IDs, so each checkbox/label pair now maintains consistent IDs across renders.

Graphite3.mp4

@Keavon Keavon marked this pull request as draft November 12, 2025 09:26
@Keavon
Copy link
Member

Keavon commented Nov 12, 2025

Thank you for your attempt, but this is not an appropriate solution. The regression needs to be fixed, not worked around by fundamentally changing its approach.

@TrueDoctor
Copy link
Member

I did also think about hashing since the random id generation just isn't a a particularly sensible design. What we could do is that we do actually unse a content based hash, which includes its location in the widget tree. Then the ids would be stable which makes the diffing substantially easier and would remove some foot guns

@ashishmohapatra240
Copy link
Contributor Author

Happy to implement either approach. Just let me know which direction you'd prefer!

@Keavon
Copy link
Member

Keavon commented Nov 13, 2025

Let's please try to fix the regression for now before switching approaches quite yet.

@TrueDoctor
Copy link
Member

I think trying to fix this in the old system would take more effort than implementing a proper fix which would be to not use random ids. The random ids did work fine before had diffing, but combining both is just a very fragile system which is prone to breaking. (And I think we should do this for all widget ids, not just the checkboxes)

@Keavon
Copy link
Member

Keavon commented Nov 13, 2025

Ok, in that case, I suggest we move back to the issue instead of the PR to discuss those plans.

@ashishmohapatra240
Copy link
Contributor Author

Sure @Keavon @TrueDoctor , let's move back to the issue. 😅

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.

Checkbox labels are now one-time use for clicking to toggle their checkbox

3 participants