Number/integer property fields (e.g. Limit) can't be edited by typing — Formly integer parser throws on nz-input-number
- Dominant language
- Scala
- Stars
- 314
- Forks
- 187
- Avg merge
- 1d 21h
- Merged PRs (30d)
- 214
Description
### What happened?
Typing into an integer operator property (reproduced on the Limit operator's "Limit"
field) stops updating the value — it gets stuck (e.g. at 1). The up/down stepper
buttons still work; only typed input is broken.
Root cause (verified in the browser console): @ngx-formly/core's json-schema integer
parser runs on value change and does:
const input = document.querySelector(`#${f.id}`);
if (input && !input.validity.badInput) { ... } // ngx-formly-core-json-schema.mjs:153
But the field id is applied to ng-zorro's ‘nz-input-number’ host element, not the
inner native ’input‘. The host has no `.validity`, so `input.validity` is undefined
and `.badInput` throws:
TypeError: Cannot read properties of undefined (reading 'badInput')
at field.parsers (ngx-formly-core-json-schema.mjs:153:58)
...
updateValue (ng-zorro-antd-input-number.mjs:262)
setValueByTyping (ng-zorro-antd-input-number.mjs:239)
onInput (ng-zorro-antd-input-number.mjs:323)
The parser branch only runs when the parsed value is null (which typing can produce
as an intermediate state), so typing throws and the value never commits — while the
stepper always sends a concrete number, skips the branch, and works.
Expected: integer/number fields stay editable by typing.
### How to reproduce?
1. Add a Limit operator; open its property panel; open the browser devtools console.
2. Type a value into "Limit" (or set a negative value and run) — the value gets stuck
and the console shows the TypeError above.
3. The +/- stepper buttons still change the value; typing does not.
https://github.com/user-attachments/assets/26447a20-6c92-4ea2-beab-8e7544d64368
### Version/Branch
1.3.0-incubating-SNAPSHOT (main)
### Commit Hash (Optional)
_No response_
### What browsers are you seeing the problem on?
_No response_
### Relevant log output
```shell
ERROR TypeError: Cannot read properties of undefined (reading 'badInput')
at field.parsers (ngx-formly-core-json-schema.mjs:153:58)
at ngx-formly-core.mjs:978:59
at Array.map ()
at ngx-formly-core.mjs:978:32
...
updateValueAndValidity @ forms.mjs:1310
setValue @ forms.mjs:2087
updateControl @ forms.mjs:1739
updateValue @ ng-zorro-antd-input-number.mjs:262
setValueByTyping @ ng-zorro-antd-input-number.mjs:239
onInput @ ng-zorro-antd-input-number.mjs:323
```
Contributor guide
Research direction
Reproduce the issue with the Limit operator and inspect the integer parser in ngx-formly-core-json-schema.mjs alongside the typing path in ng-zorro-antd-input-number.mjs. Confirm the parser and input integration handle intermediate typed values without a console error, while typed integer/number fields update normally and the stepper buttons remain functional.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- angular
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 68/100