Description
When a KindOfQuantity property is edited in the property grid and its active format has the trailZeroes trait enabled, entering edit mode replaces the displayed value with a "high precision" formatted value that forces precision = 12 while keeping the format traits. Because trailZeroes is retained, the value is padded out to the full 12 decimal places.
For example, a value that displays as 25.0 ft becomes 25.000000000000 ft the moment the field is focused for editing.
Root cause
In useFormatterAndParser packages/components/src/presentation-components/properties/inputs/UseQuantityValueInput.tsx, clones the formatter spec for editing and overrides precision:
The trailZeroes (and keepDecimalPoint) format traits are left intact, so applyFormatting pads the value with trailing zeros up to the new 12-digit precision. The idle/display value uses the unmodified defaultFormatter, which is why the padding only appears in edit mode.
Expected behavior
The high-precision edit formatter should preserve significant digits without padding — i.e. when bumping precision for editing, the trailZeroes trait should be removed (and ideally keepSingleZero/keepDecimalPoint handled) so the edit field shows 25.0 (or 25) rather than 25.000000000000.
Steps to reproduce
Configure a format set where a length/KOQ format has the trailZeroes trait enabled.
Select an element and open the property grid.
Click a quantity property (e.g. one displaying 25.0 ft) to enter edit mode.
Observe the edit field shows 25.000000000000 ft instead of the displayed value.
Description
When a
KindOfQuantityproperty is edited in the property grid and its active format has thetrailZeroestrait enabled, entering edit mode replaces the displayed value with a "high precision" formatted value that forcesprecision = 12while keeping the format traits. BecausetrailZeroesis retained, the value is padded out to the full 12 decimal places.For example, a value that displays as
25.0 ftbecomes25.000000000000 ftthe moment the field is focused for editing.Root cause
In useFormatterAndParser
packages/components/src/presentation-components/properties/inputs/UseQuantityValueInput.tsx, clones the formatter spec for editing and overrides precision:The
trailZeroes(andkeepDecimalPoint) format traits are left intact, soapplyFormattingpads the value with trailing zeros up to the new 12-digit precision. The idle/display value uses the unmodifieddefaultFormatter, which is why the padding only appears in edit mode.Expected behavior
The high-precision edit formatter should preserve significant digits without padding — i.e. when bumping precision for editing, the trailZeroes trait should be removed (and ideally keepSingleZero/keepDecimalPoint handled) so the edit field shows 25.0 (or 25) rather than 25.000000000000.
Steps to reproduce
Configure a format set where a length/KOQ format has the trailZeroes trait enabled.
Select an element and open the property grid.
Click a quantity property (e.g. one displaying 25.0 ft) to enter edit mode.
Observe the edit field shows 25.000000000000 ft instead of the displayed value.