Skip to content

MudPicker: Set TextUpdateSuppression based on Readonly state#11144

Merged
ScarletKuro merged 3 commits intoMudBlazor:devfrom
Anu6is:6779-MudDatePicker-TextUpdateSuppression
Apr 5, 2025
Merged

MudPicker: Set TextUpdateSuppression based on Readonly state#11144
ScarletKuro merged 3 commits intoMudBlazor:devfrom
Anu6is:6779-MudDatePicker-TextUpdateSuppression

Conversation

@Anu6is
Copy link
Contributor

@Anu6is Anu6is commented Apr 3, 2025

Description

TextUpdateSuppression defaults to true in MudBaseInput. Based on #1012, this was added to prevent issues with data input in BSS. When the Picker is set to ReadOnly however, users aren't able to directly input data into the input and text suppression is not needed. This change disables TextUpdateSuppression based on the ReadOnly state of the MudPicker

Fixes #6779
Fixes #6968
Fixes #9090

How Has This Been Tested?

Tested visually, occurs only on BSS

Before

before.fix.mp4

After

after.fix.mp4

Type of Changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation (fix or improvement to the website or code docs)

Checklist

  • The PR is submitted to the correct branch (dev).
  • My code follows the code style of this project.
  • I've added relevant tests.

@github-actions github-actions bot added bug Unexpected behavior or functionality not working as intended PR: needs review labels Apr 3, 2025
@Anu6is
Copy link
Contributor Author

Anu6is commented Apr 3, 2025

@henon @ScarletKuro
While looking into this I came across the following

protected internal virtual async Task OnBlurredAsync(FocusEventArgs obj)
{
if (ReadOnly)
{
return;
}
// all the OnBlur parents (TextField, MudMask, NumericField, DateRange, etc) currently point to this method
// which causes this method to be fired repeatedly, we can use the obj.Type of FocusedEventArgs to track it
_isFocused = false;

any reason _isFocused should not be set to false when OnBlurredAsync is called and ReadOnly is true? I'd expect line 504 to be moved above the ReadOnly condition

@Anu6is Anu6is requested a review from henon April 4, 2025 16:51
@henon
Copy link
Contributor

henon commented Apr 4, 2025

@henon @ScarletKuro While looking into this I came across the following

protected internal virtual async Task OnBlurredAsync(FocusEventArgs obj)
{
if (ReadOnly)
{
return;
}
// all the OnBlur parents (TextField, MudMask, NumericField, DateRange, etc) currently point to this method
// which causes this method to be fired repeatedly, we can use the obj.Type of FocusedEventArgs to track it
_isFocused = false;

any reason _isFocused should not be set to false when OnBlurredAsync is called and ReadOnly is true? I'd expect line 504 to be moved above the ReadOnly condition

Yes, good catch!

@sonarqubecloud
Copy link

sonarqubecloud bot commented Apr 4, 2025

@codecov
Copy link

codecov bot commented Apr 4, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.10%. Comparing base (6cdb07a) to head (5f69d76).
Report is 2 commits behind head on dev.

Additional details and impacted files
@@           Coverage Diff           @@
##              dev   #11144   +/-   ##
=======================================
  Coverage   91.09%   91.10%           
=======================================
  Files         436      436           
  Lines       14096    14096           
  Branches     2726     2726           
=======================================
+ Hits        12841    12842    +1     
  Misses        639      639           
+ Partials      616      615    -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@ScarletKuro ScarletKuro merged commit 9c1992f into MudBlazor:dev Apr 5, 2025
6 checks passed
@Anu6is Anu6is deleted the 6779-MudDatePicker-TextUpdateSuppression branch April 5, 2025 23:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Unexpected behavior or functionality not working as intended

Projects

None yet

3 participants