Unplanned
Last Updated: 28 Oct 2024 18:02 by ADMIN
Kristofer
Created on: 21 Aug 2024 09:07
Category: NumericTextBox
Type: Bug Report
1
When using Swedish culture and the initial NumericTextBox value is negative, it is not possible to type a new value

The value in a numeric textbox cannot be changed for negative numerbes unless you erase all the text and restart.

 

<TelerikNumericTextBox Decimals="4"Max="5"Value="-4.56m"Id="general"></TelerikNumericTextBox>

 

    
5 comments
ADMIN
Nadezhda Tacheva
Posted on: 28 Oct 2024 18:02

Hi Kristofer,

Thank you for your input!

I have moved the item out of the upcoming release, so we can discuss it with the development team and revisit our approach. Your feedback is appreciated and we will take it into consideration when working on the fix.

Regards,
Nadezhda Tacheva
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Kristofer
Posted on: 22 Oct 2024 11:28

Dont agree on you here. The problem does not lie in the character used for input, which is a hyphen-minus also in the Swedish Locale but in the fact that you format the data as a string using the current Locale once the control loses focus (its perfectly possible to enter any negative number using the keyboard). Also the fact that the standard input should not work in  the swedish Locale is not true

Using the following code (with a code behind decimal named "Number")

        <input type="number" @bind-value=@Number />
        <TelerikNumericTextBox @bind-Value="@Number" Id="general"></TelerikNumericTextBox>

Any changes in the Input is reflected in the TelerikNumericTextBox and vice versa



But since you use the current locale to reformat the text string

 

and after that the telerik control stops responding for new numerical characters (delete works) but the Input does not (since that still uses the "Hyphen Minus").

So the problem lies in the fact that your control uses the Locale to format the text, but not honours the locale when entering data.

Since a Swedish keybord enters a hyphen minus when you press the minus (-) button on the keyboard I think the correct solution would be to format the data using a format string with a Hyphen Minus instead of using the Locale

ADMIN
Nadezhda Tacheva
Posted on: 04 Oct 2024 10:53

Hi Kristofer,

I am currently working on this item and I am stepping in to provide an update based on my findings.

The root cause for the problem is the sign used for the negative values. In the majority of the cultures, the negative values are marked with hyphen-minus (U+002D). However, in the Swedish culture (and potentially other cultures) the sign used for negative values is minus (U+2212). This is basically a different character which is not valid for the NumericTextBox and thus, it blocks further input. For reference, you may check the behavior of the default <input type=number /> that also does not allow minus sign (only hyphen-minus).

My research shows that this behavior is related to the CLDR. See more information in this issue: https://github.com/dotnet/runtime/issues/44678.

I see that to handle the scenario, one can specify NumberFormat = { NegativeSign="-" } in the culture setting if one wants to prevent visualizing minus sign for various reasons.

I tested this configuration on my end and I can confirm that with it I am not hitting the discussed problem.

var defCulture = new CultureInfo("sv-SE") { NumberFormat = { NegativeSign = "-" } };

app.UseRequestLocalization(
           new RequestLocalizationOptions()
           {
               DefaultRequestCulture = new RequestCulture(defCulture)
           });

Can you please also test this setup and let me know if the NumericTextBox properly works with negative values on your end?

If so, we can close the issue as this is a matter of configuring the culture in the application and not dependent on the component. 

Regards,


Nadezhda Tacheva
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

ADMIN
Nadezhda Tacheva
Posted on: 27 Aug 2024 16:22

Hi Kristofer,

I managed to reproduce the issue on my end and it does seem like a bug to me. Thank you for pointing our attention to this! As a small gesture of appreciation for your report, I have rewarded your account with some Telerik points.

I tweaked the title a bit to provide some more clarity on the specific problem. I also added your vote to the item and as a creator, you are automatically subscribed to get status updates via email.

I'm afraid there is no workaround I can suggest for the time being and I hope our development team will be able to address this issue soon.

Regards,
Nadezhda Tacheva
Progress Telerik

Do you have a stake in the designеr-developer collaboration process? If so, take our survey to share your perspective and become part of this global research. You’ll be among the first to know once the results are out.
-> Start The State of Designer-Developer Collaboration Survey 2024

Kristofer
Posted on: 21 Aug 2024 09:48
Looks like it works for en-us locale but fails for sv-se, so its related to the language in some way (Maybe , as a decimal separator?)