xamarin / XamarinCommunityToolkit

The Xamarin Community Toolkit is a collection of Animations, Behaviors, Converters, and Effects for mobile development with Xamarin.Forms. It simplifies and demonstrates common developer tasks building iOS, Android, and UWP apps with Xamarin.Forms.
MIT License
1.58k stars 471 forks source link

[Bug] [MauiCompat] unexpected behavior in mask XX:XX #1981

Open barnasoba opened 1 year ago

barnasoba commented 1 year ago

Description

When using the MaskedBehavior with a mask set as "XX:XX" for an Entry control, the cursor positioning behaves unexpectedly after the third character is entered. This causes the fourth character to be inserted in the wrong position, and the resultant format becomes incorrect.

Stack Trace

N/A (Not a crash, but unexpected UI behavior)

Steps to Reproduce

  1. Create an Entry control in XAML with the MaskedBehavior set to "XX:XX".
  2. Type four consecutive numbers.
  3. Observe the cursor position and the resulting text in the Entry after the third character.

Expected Behavior

The text in the Entry should format correctly to "12:34" (given the numbers "1234" as input).

Actual Behavior

After entering the third number, the cursor repositions incorrectly, and entering the fourth number results in a format like "14:23".