SfMaskedEdit Cursor not always at the beginning of the text upon focus (if control is empty)

Hello

When using SfMaskedEdit controls and focusing (tapping), the cursor is not always at the beginning of the text (left side).
One use case is to use the SfMaskedEdit control to input a time value in the Format "HH:mm". The Promt char is a whitespace " ". If the user taps the control (and it is empty) the cursor should be at the beginning of the text. If the control has a value, the cursor should be at the end of the value (right).
(Case: SfMaskedEdit control is empty) The cursor is now sometimes at the beginning "|  :  " and sometimes at the end "  :  |". So far it seems to be pretty random when it is at the beginning and when it is at the end.

The SfMaskedEdit controls I use are are all generated in code behind and quite complex. There are bindings and some events that are used as well.


var sfMeT = new SfMaskedEdit
{
     ClassId = item.Code,
     Watermark = "HH:mm",
     Mask = "00:00",
     PromptChar = promptChar,
     ValidationMode = InputValidationMode.KeyPress,
     Keyboard = Keyboard.Numeric,
     HidePromptOnLeave = true,
     SkipLiterals = true,
};

I already tried using the "Focused" event to set the value of the SfMaskedEdit control to be empty (""), in hopes this would move the cursor at the beginning of the text but unfortunaltey this did not work.

Is there any way to make sure the cursor in the SfMaskedEdit control is always at the beginning of the text if it is empty?


Kind regards
Phil

30 Replies

RB Rabhia Beham Kathar Mideenar Syncfusion Team April 22, 2020 11:11 AM UTC

Hi Phil,

We have checked the reported issue with the code snippet provided. But we are unable to reproduce the reported issue at our end. Please find the tested sample from the below link.


Sample: https://www.syncfusion.com/downloads/support/directtrac/general/ze/Gettingstarted1946606314


Video: https://www.syncfusion.com/downloads/support/directtrac/general/ze/MaskedEditVideo.mov483624324


Could you please check the issue with the attached sample and let us know whether it is reproduced or not? If the issue was not reproduced, please revert us by modifying the sample based on your application along with replication procedure like short video or provide the sample and also share which platform that you are facing the reported issue. This will be helpful for us to investigate further and provide you a better solution at the earliest. 

Regards,

Rabhia Beham.



UN Unknown April 22, 2020 01:43 PM UTC

Thank you a lot for your quick response.

I am sorry, in my original post I forgot to mention the most important detail: this behavior occurs when deploying to an actual iOS device (iPhone).
Even with your sample, I was able to reproduce the issue.
Please try tapping anywhere on the SfMaskedEdit (except the very left side), the cursor is at least sometimes after the prompt chars "__:__|". This is quite annoying for a user, as the text needs to be deleted or the user needs to tap at the exact beginning of the SfMaskedEdit.

The behavior I expected was, that the cursor is at the beginning of the text when the SfMaskedEdit is empty and that it is at the end of the text if it has a value.


Kind regards


RS Ramya Soundar Rajan Syncfusion Team April 23, 2020 01:10 PM UTC

Hi Phil, 
  
We would like to let you know that focusing on the SfMaskedEdit with empty space, cursor always position at the beginning. Tap on the control to edit again, the cursor positioned at the end because it considered whitespace as character. 
  
Query: Please try tapping anywhere on the SfMaskedEdit (except the very left side), the cursor is at least sometimes after the prompt chars "__:__|" 
  
Currently we don’t have support to restrict the cursor to point with empty spaces. We have already considered feature request to provide cursor position changing event by using its arguments you can restrict the cursor position. Please find the feedback link from below.  
  
  
Please cast your vote to make it count. We will prioritize the features every release based on the demands and we do not have immediate plan to implement this feature since we committed with already planned work. So, this feature will be available any of our upcoming release.  
  
If you have any more specification/suggestions to the feature request, you can add it as a comment in the portal.  
  
Regards, 
Ramya S 



LS Lester Sconyers July 2, 2020 09:22 PM UTC

We have been having the same behavior for a phone number masked entry. The problem is still present as of 18.1.0.59. Any solutions or workarounds?


RS Ramya Soundar Rajan Syncfusion Team July 3, 2020 08:04 AM UTC

Hi Lester, 
 
We would like to let you know that we tried out the possible workaround, but due to some technical blocks, we didn’t achieve that. Hence only we have logged a feature request on this.  
 
Now only we have added this feature in our Wishlist for Volume 3, 2020 release.  So, please be wait until, our Volume 3 release has been rolled out which is expected to be by end of September 2020. 
 
Regards, 
Ramya S 



RS Ramya Soundar Rajan Syncfusion Team October 6, 2020 01:19 PM UTC

Hi Lester, 
 
We are glad to announce that our Essential Studio 2020 Volume 3 release v18.3.0.35 is rolled out and is available for download under the following link. 
 
 
We thank you for your support and appreciate your patience in waiting for this release. Please get in touch with us if you would require any further assistance. 
 
Regards, 
Ramya S 



UN Unknown October 12, 2020 06:35 AM UTC

Thank you for implementing a fix to this problem.


However, it seems that the problem still persists.
Some other user, Jassim Rahma (which I do not know and does not work in my company) posted a video that still shows issues with the SfMaskedEdit control.


Could you please have a look at it?


RS Ramya Soundar Rajan Syncfusion Team October 13, 2020 06:37 AM UTC

Hi Phil,  
  
In order to resolve this cursor position changes in the SfMaskedEdit control, please use the CursorPositionChanging event. We have addressed the issue reproducing use case from Jassim and resolved it through cancelling the cursor position change by setting the true to the Cancel argument of CursorPositionChangingEventArgs with validating the case. 
 
Please find the sample in below 
  
   
Regards,  
Ramya S  



ES Etienne Steyn December 11, 2020 02:28 PM UTC

I'm also experiencing this issue, unfortunately even after the latest update, The CursorPositionChanging event doesn't fire not even after the first time one taps on it, nor  the second or third time, the only time it fire's is when a user types, which is too late, because by that they'd most probably be confused as to why nothing is happening when they type, which is a result of the cursor being placed right at the end of the MaskedEdit.


RS Ramya Soundar Rajan Syncfusion Team December 14, 2020 11:58 AM UTC

Hi Etienne Steyn, 
 
We have analyzed your reported and. Can you please provide the detailed information on the reported query since we were unaware of your exact use case of your requirement?   
 
Can you please share the following details?   
  
·       Can you please share the issue reproducing platform with device configuration? 
·       If possible, can you please provide the code snippet or sample?  
·       Can you share the short demo to replicate the issue in our side?  
·       Whether you are mentioning the event not firing when change the cursor position before entering the value or when typing the value, the event not firing?  
 
Based on your confirmation we are going to check the reported problem. We hope it makes clear that we can work on this without having a misleading to proceed further in our side.  
 
Regards, 
Ramya S 



ES Etienne Steyn December 15, 2020 01:45 PM UTC

Hi Ramya, 

The issue I'm having is similar, if not, the exact same issue that Phil described when the issue was first logged, even the the platform on which the issue occurs is the same. When I tap on the MaskedEdit,  the cursor is placed at the end of the control (unless I explicitly tap the exact left side of the control) which is really bad from a UX view point.


RS Ramya Soundar Rajan Syncfusion Team December 16, 2020 12:26 PM UTC

Hi Etienne Steyn, 
 
We have checked the reported issue with iPad device with different type of Mask. Please find the video from the below link.  
 
 
Cursor position behave differently while focusing the control in iOS Simulator. We have encountered the same problem with Framework Entry control too. So, we have tested the reported issue in real time device and taken video. So, please check the issue with real time device and let us know whether the issue is reproduced while adding Mask and value is empty. 
 
If the issue is reproduced in real device, please share the MaskedEdit code snippet and video. We will check our side further and update the details. 
 
Regards, 
Ramya S 



AN Andrew February 26, 2021 02:39 PM UTC


Our problem is similar to the situation described above. The behavior only occurs on an iPhone device (not in the simulator). As can be seen in the code, a mask (Mask = "0000 000000") is used. If you tap on the empty field, the cursor position is correct and far left on the first attempt. With a second tab, the cursor position is either on the far right or in the middle, although the field is still empty. The cursor position is only correct as expected if you tap on the far left. Unfortunately, this is not reasonable for our test users and we have to remove the control if no solution is found. The problem is only reproducible on an iPhone device.

Version: Syncfusion.Xamarin.SfMaskedEdit.IOS 18.4.0.44

Code Snipped:

<inputLayout:SfTextInputLayout x:Name="svnrInputLayout" ErrorText="Invalid svnr number" ContainerBackgroundColor="Transparent" ContainerType="Outlined" ErrorColor="{x:Static constants:Constants.signalOrange}" UnfocusedColor="White" FocusedColor="White" HeightRequest="60" OutlineCornerRadius="30" LeadingViewPosition="Inside" Margin="0, 0, 0, 10" >
<maskededit:SfMaskedEdit x:Name="svnrEntry" Keyboard="Numeric" Mask="0000 000000" ValueMaskFormat="ExcludePromptAndLiterals" MaskType="Text" ValidationMode="KeyPress" 
                                             ValueChanged="ValidateSvnrEntry" TextColor="white" Watermark="SVNR-No." WatermarkColor="white" HorizontalOptions="FillAndExpand" 
                                             FlowDirection="LeftToRight" /> 
</inputLayout:SfTextInputLayout>

Workaround with CursorPositionChanging="SvnrEntry_CursorPositionChanging" has no effect.




SS Sridevi Sivakumar Syncfusion Team March 1, 2021 01:14 PM UTC

Hi Andreas Resch,

We have checked the reported issue. As per current implementation when focusing initially OR un-focusing and focusing the control, the cursor will be positioned correctly in the start position. The problem occurs when the control is already in focus and again Tapped on the control text, it is automatically moves to the last or middle (as space is available in middle) position.

We have checked this behavior with framework control Entry in Forms.iOS. Both Forms Entry and SfMaskedEdit inherit the Native UITextField and worked similarly when you Tapped the control text after control focused. We have positioned the cursor when control is focused. Hence, moving cursor to the last or middle position on control Tapped is the behavior of the native control and it is not the control side issue. You could please check with native framework control behavior and let us know if you have any concerns.


Regards,
Sridevi S.

 



WI William September 6, 2021 04:56 PM UTC

Hi there,


I'm not sure what the result of this was in the end? From a logical perspective from an end-user perspective:


1) When the control is focussed for the first time, with only the mask present and no user text, the cursor should be positioned at the start so the user can begin typing.


2) When the user has already entered text and the control is focussed, the cursor should be positioned at the end (or select the whole text if `SelectAllOnFocus` is set to true).


From what I am experiencing when the control is focussed it is completely random if the cursor appears at the start or end. It is very frustrating for the end-user when the cursor is positioned after the mask by default as they then have to reposition it to the start. This is happening for me on the simulator and on the device. It is not something I would expect to solve with the `CursorPositionChanging` event, it should be the default behavior as this is logical. It is also fine to say this is the default for the Entry control, but this is a different control and as the Entry doesn't use a mask they cannot be compared.


It seems a few users have suggested this and the control has not been updated, the cursor still positions randomly and not at the start. I hope Syncfusion can have a think about this default behavior and update the control. In the mean time did anybody find a workaround?


Many thanks


Wi



ET Eswaran Thirugnanasambandam Syncfusion Team September 7, 2021 03:09 PM UTC

Hi William 
 
Thanks for your update. 
 
We have checked your query, and the reported issue occurs only in the iOS simulator. In Android and iOS devices, the cursor will be positioned correctly based on the text typed. Ie., When the text is not typed, the cursor will be positioned in the first place, and when the text is typed, the cursor will be positioned at the latest typed position when focusing on the control. 
 
We have prepared the sample and video to show the cursor is positioning correctly. Please get the sample and video demo from the below link. 
 
 
Video Links: 
 
Please let us know if you need any further assistance.  
 
Regards, 
Eswaran.


WI William September 8, 2021 01:29 PM UTC

Hi there,


This is not the case that I have experienced. For me it is happening both in the simulator and on the device. I have attached a video showing me tapping on the control for the first time on an iPad and the cursor being positioned at the end, ie. after the mask. Sometimes it goes to the end, sometimes to the start. It should always default to the end. The code I have used is from your sample:




Many thanks


Will


Attachment: IMG_1105_1c2a74ef.zip


RS Ramya Soundar Rajan Syncfusion Team September 9, 2021 11:21 AM UTC

Hi William, 
 
Currently we are checking your reported problem with different iOS devices. We will update you the details on September 13, 2021. 
 
Regards, 
Ramya S 



ET Eswaran Thirugnanasambandam Syncfusion Team September 10, 2021 10:39 AM UTC

Hi William, 
 
Thanks for your update. 
 
We checked the reported problem with the provided code snippet in the following real time devices. But we are afraid that we are unable to reproduce it from our side. 
 
·         iPad Device 
·         iPhone 7 Plus 
 
We have prepared a video in iPad device to show the cursor is positioning correctly. Please get it from the below link. 
 
Please check the video. If you still face any problem, can you revert us by sharing the device details, this will help us to provide you a better solution at the earliest. 
 
Regards, 
Eswaran.


WI William replied to Eswaran Thirugnanasambandam September 13, 2021 09:50 AM UTC

Hi Eswaran,


The device I have tested on is an iPad. Just to make sure we are talking about the same thing, I am talking about when the control is focussed by a touch input. I'm not sure from your video if this is the case?


Will



ET Eswaran Thirugnanasambandam Syncfusion Team September 14, 2021 11:35 AM UTC

Hi William, 
 
Thanks for your update. 
 
We checked the reported problem by focusing the control by touch input as you have mentioned in the provided video with the following real time devices. But we are afraid that we are unable to reproduce the issue from our side.  
 
         iPad Device 
         iPhone 7 Plus 
         iPod Touch 
 
Can you please check the problem on any other iOS device and let us know if you are still experiencing the same issue. 
 
Regards, 
Eswaran. 



WI William September 30, 2021 09:58 AM UTC

Hi Eswaran,


I have also seen this issue on an iPhone device, iPhone 11 I believe. Same issue as in the video I posted. At least I can definitely say I have had no issues on Android devices.


Thanks


Will



RS Ramya Soundar Rajan Syncfusion Team October 1, 2021 10:20 AM UTC

Hi William, 
 
As we informed earlier, the reported problem will not occur in the iOS real devices and ensured in already mentioned real devices. Due to unavailability of the iPhone 11 devices, we need some more time to ensure the reported problem in iPhone 11. In the meantime, could you please confirm whether the problem occurs on different iPhone devices other than iPhone 11? 
 
Regards, 
Ramya S 



FS Fabian Swoboda October 26, 2021 08:34 AM UTC

Hello,

we have the same behavior on iOS devices as William. No matter what i try, the cursor is always placed at the end of the Mask when focusing the empty maskedit.

Mask: LL00 0000 0000 0000 0000 00 (IBAN)

Syncfusion: 19.3.0.46

Device: iPad Air 3rd generation

iOS: 15

xcode: 13



Regards,




ET Eswaran Thirugnanasambandam Syncfusion Team October 28, 2021 02:47 PM UTC

Hi Fabian Swoboda, 
 
Thanks for your update. 
 
We have checked the reported problem “SfMaskedEdit Cursor not always at the beginning of the text upon focus” and the issue reproduced only in the latest iOS version with real devices. Due to device unavailability, we have considered it as an internal bug and will move the fix on or before our upcoming volume 4 release which is expected to be rolled out at the end of December 2021. We appreciate your patience until then. 
 
Regards, 
Eswaran. 



VR Vignesh Ramesh Syncfusion Team December 20, 2021 06:14 PM UTC

Hi Fabian Swoboda, 


Thanks for your patience.


We have fixed the reported issue “[iOS] SfMaskedEdit cursor not always at the beginning of the text upon focus” and this is included in our Volume 4 release.


We are glad to announce that our Essential Studio 2021 Volume 4 release v19.4.0.38 is rolled out and is available for download under the following link.


https://www.syncfusion.com/forums/171304/essential-studio-2021-volume-4-main-release-v19-4-0-38-is-available-for-download


We thank you for your support and appreciate your patience in waiting for this release. Please get in touch with us if you would require any further assistance.


Regards,

Vignesh Ramesh.



WI William December 23, 2021 07:31 PM UTC

Hi Vignesh,


This update seems to have resolved the problem for me, many thanks!


Will



VR Vignesh Ramesh Syncfusion Team December 27, 2021 06:14 AM UTC

Hi William, 
  
We are glad to hear that the provided fix resolved the problem. Please get in touch with us if you would require any further assistance. 
  
Regards,  
Vignesh Ramesh. 



FS Fabian Swoboda January 11, 2022 11:47 AM UTC

Hi,

also tested it and it works as expected. Thanks for the fix.


Regards,

Fabi



ET Eswaran Thirugnanasambandam Syncfusion Team January 12, 2022 05:34 AM UTC

Hi Fabian Swoboda, 
 
We are glad to hear that the provided fix resolved the problem. Please get in touch with us if you would require any further assistance.  
 
Regards, 
Eswaran 


Loader.
Up arrow icon