Page MenuHomePhabricator

Can't use comma as decimal separator for Other amount in some banners
Closed, ResolvedPublic

Description

Chrome blocks typing a comma completely. Desktop Safari allows typing it, but considers the value invalid (so it fails our validation). Haven't yet tried mobile Safari.

Seems to be due to <input type="number"> because it doesn't occur in desktop large which is <input type="text">

I'm sure this was working previously.

Event Timeline

CC'ing @CCogdill_WMF for FYI and I can also reproduce this on donate wiki (where it's also input type = number), FWIW.

Thanks @spatton. That's annoying, but also helpful as it rules out it being related to the inline validation we added to banners.

Okay, researching a bit more and my own testing found that handling of decimal points in different browsers is all over the place, and sometimes depends on the OS language as well as the page language. https://www.ctrl.blog/entry/html5-input-number-localization

Using inputmode="decimal" and type="text" looks like it might be a better solution, although I haven't tested yet. Support is coming in the next version of iOS Safari. https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/inputmode

Okay, I've changed desktop small banners and donatewiki to use type="text" with inputmode="decimal" so that a comma can be used as decimal point in any language or browser.

However I think changing the mobile banners to this would be worse, since it currently stops the numeric keyboard coming up on Mobile Safari. Let's revisit once support for inputmode is solidified.

Changed all current best banners to use type="text" and inputmode="decimal", since this is supported in Chrome and the current version of Mobile Safari. "Can I use" estimates support at >83% of tracked mobile browsers.

Looks like this might be nice to do on payments-wiki too, for cases when the amount box is editable

Change 529120 had a related patch set uploaded (by Ejegg; owner: Ejegg):
[mediawiki/extensions/DonationInterface@master] WIP: allow , as decimal separator in amount

https://gerrit.wikimedia.org/r/529120