openhab / openhab-webui

Web UIs of openHAB
Eclipse Public License 2.0
214 stars 235 forks source link

[BasicUI/firefox] Leading + not accepted in input widget with hint number #1962

Open lolodomo opened 1 year ago

lolodomo commented 1 year ago

Which UI are you reporting an issue for?

The problem

For a number item, an input widget with hint number, you cannot fill a value containing a leading + like for example "+12". "-12" and "12" are of course accepted. It was tested in Firefox.

Expected behavior

The leading + should be accepted.

mherwege commented 11 months ago

I just tested this on the release version of OH in Chrome and Firefox. It worked for me. Any further hint on when it goes wrong?

lolodomo commented 11 months ago

Here are my two items:

Number TestNumber "Test number [%.2f]" (GTest1)

Number:Length TestNumberDim1 "Test number dim 1 [%.1f cm]" (GTest1) { unit="mm" }

and my sitemap:

sitemap test4 label="Tests"
{
    Frame label="Input number hint number" {
        Input item=TestNumber inputHint="number"
        Input item=TestNumberDim1 label="Test number dim 1 [%f mm]" inputHint="number"
        Input item=TestNumberDim1 label="Test number dim 1 [%f cm]" inputHint="number"
    }
}

I first entered some values: image

Now look at what I fill in the field for example: image

Then if I push the Enter key or click outside the field, the old value is restored: image

Same thing with the other number.

lolodomo commented 11 months ago

I just tested in Chrome and Edge and it is working. The bug is only with Firefox.

mherwege commented 11 months ago

I just tested in Chrome and Edge and it is working. The bug is only with Firefox.

That’s what I expected, and not easy to solve. Edge and Chrome use the same engine. I noticed a difference with number validation in Firefox before. Therefore I was surprised it worked for me also in Firefox last week. I need to look for the references again, but there were some Firefox development issues on this before, largely classified as won’t fix, or where the fix did not solve everything.

I think we should label this as won’t fix for the underlying dependency. Otherwise we need to completely drop use of native browser number functionality and base everything on text.

lolodomo commented 11 months ago

I think we should label this as won’t fix for the underlying dependency.

Done but I would appreciate you check that is not a bug in our code.

mherwege commented 11 months ago

@lolodomo I tried with exactly your example in Firefox. It does work for me. I tried various combinations of language settings in Firefox as well. It all worked. The only time I could make it fail is when I put a space in front of the +, but the + worked. I am on a Firefox Extended Support Release on Windows (102.13.0esr (32-bit)). Could that have something to do with it?

lolodomo commented 11 months ago

My Firefox version: 115.0.3 (64 bits)

mherwege commented 11 months ago

I am not able to test with the non esr version of Firefox. I am unable to reproduce, so can't do much at the moment.