Number fields accepting infinity is opaque
Author: BeksOmegaCreated Apr 17, 2021Updated Sep 25, 2026
Labelshelp wantedgood first issuearea: blocks & fieldsarea: docs & examples
Description
By default, Blockly's number input fields accept values of 'Infinity', 'infinity', '-Infinity', and '-infinity' (source code). This behavior may not be expected by developers, and could cause them issues if they are expecting their inputs to be finite.
Recommendation
Some things that could help resolve this issue are:
- Documenting this behavior on the number fields page.
- Adding a parameter to the number field config to make it only accept finite values.
But I'm not sure which of those are necessary/useful.
Additional Info
See the linked issues below this issue for an example of where this causes a problem.
Source: RaspberryPiFoundation/blockly