MudColorPicker: Fix support for null color values and throttling#12567
MudColorPicker: Fix support for null color values and throttling#12567danielchalmers merged 13 commits intoMudBlazor:devfrom
Conversation
|
Hm I'm a bit perplexed by the failed During the test here MudBlazor/src/MudBlazor/Components/ColorPicker/MudColorPicker.razor.cs Lines 409 to 446 in ad63f16 The obvious fix is to have it also call Does anyone know if this there a reason for this behavior? Glancing around the rest of the project I don't see this pattern anywhere else. |
Honestly, no. This is pretty damn old code from ~5 years ago, and it was hard to migrate it from the anti-pattern setter/getter logic in parameters #10357. I mainly kept it how it was before, with all its quirks. I’m mostly waiting for this #12556 so I can give it a proper refactor and not have to deal with all the Text ↔ Value synchronization. upd: The |
|
Ah thanks for the clarification, looking forward to seeing I also found that removing the default color for I've added a new private getter called All inputs internal to the color picker now use this getter instead of accessing This is a bit larger of a PR than I initially expected, so please let me know if there are any changes you'd like me to make. |
|
It would be nice if you add bUnit test from #11775 <MudForm @ref="_formRef">
<MudColorPicker @bind-Text="_colorValue" Placeholder="Select Color"
Required="true"
Editable="true" />
</MudForm>
<MudButton Color="Color.Primary" OnClick="Submit">Ok</MudButton>
@code {
private MudForm _formRef = null!;
private string _colorValue;
private Task Submit()
{
return _formRef.Validate();
}
}and check if form is red. |
…udBlazor#11775 Add bunit test for color picker required with null value
|
Okay I've added two new tests and made a couple more tweaks. One test called The other called I've also updated the test |
|
@danielchalmers double checking if we are ok with these change that the default is not null value (see screenshots) |
|
I'll try to test and review this today or tomorrow |
|
@danielchalmers retest. I added a test as well, which fails before that fix |
|
Throttle no longer applies (tested on both server and wasm) Video8.mp4Rest of the examples seemed fine |


Fixes #11775
Fixes the any case where no Value is supplied defaulting to
#594ae2. For example most of the color pickers on the component's docs page.After fix:

Checklist: