Skip to content

MudAutocomplete: Fix Text coersion on Tab key (OnBlur or CloseMenu)#10074

Merged
henon merged 5 commits intoMudBlazor:devfrom
HClausing:AutoCompleteTextCoersion
Oct 23, 2024
Merged

MudAutocomplete: Fix Text coersion on Tab key (OnBlur or CloseMenu)#10074
henon merged 5 commits intoMudBlazor:devfrom
HClausing:AutoCompleteTextCoersion

Conversation

@HClausing
Copy link
Member

Description

Related issues / PRs: #3824, #3825, #8914

The component was invalid closing the Menu on Tab Key Down, just by setting Open = false. By this way never call the CoerceTextToValueAsync() method. Instead, now it's changed to await CloseMenuAsync();.

Another unexpected behavior that appeared after this fix is about combining ResetValueOnEmptyText and CoerceText. The CoerceText was forcing the last valid value to Text even with empty input. Now Value and Text are set to null on empty text.

How Has This Been Tested?

  • Visual tests;
  • Unit tests: AutocompleteTextCoercionOnTabKeyTest() and AutocompleteTextCoercionAndResetIfEmptyTextTest.

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)
  • Fix for Close Menu called on OnInputKeyDownAsync by Tab key, now calling CloseMenuAsync() and CoerceTextToValueAsync() correctly (even on blur), instead just settings Open = false;

  • Fixed CoerceTextToValueAsync() to skip coersion if ResetValueOnEmptyText = true and Text = string.Empty.

Checklist

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

… method, now calling CloseMenuAsync() and CoerceTextToValueAsync() correctly (even on blur).

- Fixed CoerceTextToValueAsync() to skip coersion if ResetValueOnEmptyText is true.
@github-actions github-actions bot added bug Unexpected behavior or functionality not working as intended PR: needs review labels Oct 22, 2024
@codecov
Copy link

codecov bot commented Oct 22, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.14%. Comparing base (cc48517) to head (236e1ae).
Report is 7 commits behind head on dev.

Additional details and impacted files
@@           Coverage Diff           @@
##              dev   #10074   +/-   ##
=======================================
  Coverage   91.13%   91.14%           
=======================================
  Files         410      411    +1     
  Lines       12462    12484   +22     
  Branches     2419     2423    +4     
=======================================
+ Hits        11357    11378   +21     
  Misses        560      560           
- Partials      545      546    +1     

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

@ScarletKuro ScarletKuro requested a review from henon October 22, 2024 17:12
@ScarletKuro
Copy link
Member

cc @vernou (can't add in review for some reason)

@HClausing HClausing requested a review from vernou October 22, 2024 19:09
@henon
Copy link
Contributor

henon commented Oct 23, 2024

cc @vernou (can't add in review for some reason)

Fixed. He wasn't in the MudBlazor org contribution team yet.

@henon henon changed the title MudAutocomplete: Text coersion by Tab key (OnBlur or CloseMenu) MudAutocomplete: Fix Text coersion on Tab key (OnBlur or CloseMenu) Oct 23, 2024
@henon henon merged commit 1172631 into MudBlazor:dev Oct 23, 2024
@henon
Copy link
Contributor

henon commented Oct 23, 2024

Thanks @HClausing!

@HClausing
Copy link
Member Author

Thanks @HClausing!

Thanks for merging. I'm happy to be back on contributing.

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 hacktoberfest Hacktoberfest 2021 hacktoberfest2024

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants