Fix bug causing 0 to be written into a numeric field when tabbing

(closes #5087)
This commit is contained in:
Bryan Housel
2018-06-17 11:51:51 -04:00
parent 20ee616cdf
commit 5555b61e87

View File

@@ -110,11 +110,13 @@ export function uiFieldText(field, context) {
function change(onInput) {
return function() {
var t = {};
var val = utilGetSetValue(input) || undefined;
var val = utilGetSetValue(input).trim() || undefined;
if (!onInput && field.type === 'number') {
val = clamped(parsed(val)) + '';
utilGetSetValue(input, val);
if (!onInput) {
if (field.type === 'number' && val !== undefined) {
val = clamped(parsed(val)) + '';
}
utilGetSetValue(input, val || '');
}
t[field.key] = val;
dispatch.call('change', this, t, onInput);