Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] MaskedBehavior mask is not applied right away when entry is right aligned #2515

Open
2 tasks done
lancecontreras opened this issue Feb 12, 2025 · 1 comment
Open
2 tasks done
Labels
area/behaviors Issue/Discussion/PR that has to do with Behaviors bug Something isn't working unverified

Comments

@lancecontreras
Copy link

lancecontreras commented Feb 12, 2025

Is there an existing issue for this?

  • I have searched the existing issues

Did you read the "Reporting a bug" section on Contributing file?

Current Behavior

When using a MaskedBehavior on an entry while the entry's HorizontalTextAlignment is to the end (right aligned), the masking is not applied upon reaching the position of the mask.

For example:

Mask = "0000.00"
Entered text = "123"
Masked text = "123"

Expected Behavior

Since the HorizontalTextAlignment is set to the end (right), the expected behavior is that the input to the entry starts from the right. Therefore, when the mask position is hit, it should apply the mask.

Mask="0000.00"
Entered text = "123"
Expected masked text = "1.23"

Steps To Reproduce

  1. Create a new MAUI project and add the CommunityToolkit
  2. Add an entry to the page
  3. Add Masked behavio
  4. Set mask to "0000.00"
  5. Set UnmaskedCharacter to "0"
  6. Run the app
  7. Notice that the masking will not apply upon hitting the position of the dot.
     <Entry HorizontalTextAlignment="End" HorizontalOptions="End">
       <Entry.Behaviors>
         <toolkit:MaskedBehavior Mask="0000.00" UnmaskedCharacter="0" />
       </Entry.Behaviors>
     </Entry>

Link to public reproduction project repository

https://github.com/lancecontreras/MaskedEntryExample

Environment

- .NET MAUI CommunityToolkit: 11
- OS: Android
- .NET MAUI: 9

Anything else?

This will probably be the same issue on Windows or ios but I haven't tested those.

@lancecontreras lancecontreras added bug Something isn't working unverified labels Feb 12, 2025
@lancecontreras lancecontreras changed the title [BUG] MaskedBehavior doesn't consider the HorizontalTextAlignment of an Entry [BUG] MaskedBehavior mask is not applied right away when entry is right aligned Feb 12, 2025
@vhugogarcia vhugogarcia added the area/behaviors Issue/Discussion/PR that has to do with Behaviors label Feb 21, 2025
@bijington
Copy link
Contributor

The HorizontalTextAlignment property just determines where the text is aligned within the Entry field it doesn't determine the flow of the text. I don't think what you are asking for is possible right now but I don't think the current behaviour is wrong. I suspect you would need some form of additional property on the behaviour to determine this flow - I can't think of how to suggest it right now though

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/behaviors Issue/Discussion/PR that has to do with Behaviors bug Something isn't working unverified
Projects
None yet
Development

No branches or pull requests

3 participants