openui5 icon indicating copy to clipboard operation
openui5 copied to clipboard

StepInput in different browser ... (Precision and comma vs. dot)?

Open pa775 opened this issue 8 years ago • 6 comments

OpenUI5 version: latest version

Browser/version (+device/version): Firefox latest version, Chrome latest version, IE version 11. for this issue only tested on a desktop PC

URL (minimal example if possible): https://openui5.hana.ondemand.com/#/sample/sap.m.sample.StepInput/preview

Description There is a different behavior between e.g. Chrome, Firefox and IE (for us unfortunately version 11). When a StepInput field is set with a “displayValuePrecision” greater than 0.

IE and Chrome display the precision correctly. Firefox will display only as many precisions as the given value will have. e.g. displayValuePrecision = 3, given value = 1,32

**Chrome: image

Firefox: image

IE:** image

Tested with the StepInput Sample Page in Chrome, Firefox and IE: https://openui5.hana.ondemand.com/#/sample/sap.m.sample.StepInput/preview

The next issue is the rendering of the value inside a StepInput field.

At the very beginning of the App we set the language relevant parts as follows:

sap.ui.getCore().getConfiguration().setLanguage('en'); // normally this will be variable
sap.ui.getCore().getConfiguration().setFormatLocale('de-DE'); // normally this will be variable

The app will be started as a redirect from a portal page, therefore the language should be the same as the redirecting app. The display of dates, numbers etc. should be displayed according to the browser setting itself.

**Chrome image

Firefox image If we remove the “setLanguage” snippet Firefox will display the following (comma vs. dot): image

IE** image

For the IE browser it doesn’t matter what will be set.

All after all, the render method of display a “normal” input field and a StepInput field seems to be different, when a precision is set ( >0).

How we can handle this issue to have the same result in every brower (comma vs. dot, number of precisions)?

pa775 avatar Jul 17 '18 09:07 pa775

Hello @pa775 , I tried to reproduce the issue with a jsbin example by setting different location in different browsers, but I didn't manage to reproduce it. Could you please provide instructions how to reproduce the issue. Regards, Diana

Shtilianova avatar Jul 19 '18 11:07 Shtilianova

Hello @Shtilianova, just try the jsbin example with different browser and you will the the effect (or a part of the effect).

on IE image

on Firefox image

on Chrome image

Best regards Sascha

pa775 avatar Jul 19 '18 12:07 pa775

Hello @pa775 , Thank you for the fast replay. Meanwhile I made an additional investigation I found that there is different implementation on different browsers regarding handling "," behavior. You could check this pure html jsbin example. You could check that in some browser you are able to write "," in other not. Also some browsers are automaticaly convert "," to ".". The observed behavior of StepInput is a side effect of this browser specific implementation. Since this is not OpenUI5 control issue I'm closing the ticket. If you have some additional questions please reopen the ticket. Regards, Diana

Shtilianova avatar Jul 19 '18 12:07 Shtilianova

Hello @Shtilianova,

maybe it can be, that different browser will do some converts or will handle dot / comma differently. But the effect, that a StepInput shows a DOT and a normal InputField displays a comma is not quite clear to me. If every field (StepInput & Input) on a page will show a comma or dot (browser behavior) would be ok, but a mix between StepInput and normal Input is not easy to explain to our customers.

image

Regards, Sascha

pa775 avatar Jul 19 '18 12:07 pa775

Hello @pa775 , Thank you for the additional information. I manage to reproduce that issue . I've created an internal incident 1880443454. The status of the issue will be updated here in GitHub. Regards,Diana

Shtilianova avatar Jul 20 '18 07:07 Shtilianova

Hello @pa775,

as @Shtilianova mentioned in her previous answer this is how different browsers handle normal HTML input. I will try to explain in more details the difference and what options you have.

As you know HTML input could be created with different type attribute (lets look only at number and text).

If you create the input with type text in Chrome and Firefox it will render the decimal as a dot. However, if you use type number you can see that in German locale the decimal point in Chrome will be a dot and in Firefox it will be a comma.

Check this JSBin: http://jsbin.com/gehelidolu/2/edit?html,output

And now why sap.m.StepInput and sap.m.Input renders the number in Firefox with a comma and a dot respectively. As you can already guess sap.m.StepInput uses input with a type number and sap.m.Input uses input with type text.

Check this JSBin: https://jsbin.com/danotuvabi/edit?html,output

You can always change the type of sap.m.Input to number by setting its property type to Number

This is a browser behavior so I am closing this issue.

Best Regards, Adrian

adrian-bobev avatar Aug 01 '18 20:08 adrian-bobev