fix: use inputmode="decimal" for Float, Currency, and Percent fields
ControlFloat inherits from ControlInt, which sets `inputmode="numeric"`. On mobile devices, this brings up a numeric keypad without a decimal point, making it impossible to enter decimal values (e.g. 0.16, 0.18) for Float, Currency, and Percent fields. Fix: Override `input_mode` to `"decimal"` in ControlFloat. Per the HTML spec, `inputmode="decimal"` instructs mobile browsers to display a numeric keypad that includes a decimal separator. Since ControlCurrency and ControlPercent both extend ControlFloat, they automatically inherit the fix.
This commit is contained in:
parent
fcc672315f
commit
dd63ab9d9e
1 changed files with 1 additions and 0 deletions
|
|
@ -1,4 +1,5 @@
|
||||||
frappe.ui.form.ControlFloat = class ControlFloat extends frappe.ui.form.ControlInt {
|
frappe.ui.form.ControlFloat = class ControlFloat extends frappe.ui.form.ControlInt {
|
||||||
|
static input_mode = "decimal";
|
||||||
parse(value) {
|
parse(value) {
|
||||||
value = this.eval_expression(value);
|
value = this.eval_expression(value);
|
||||||
return isNaN(parseFloat(value)) ? null : flt(value, this.get_precision());
|
return isNaN(parseFloat(value)) ? null : flt(value, this.get_precision());
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue