Skip to content

RAC NumberField: roundingMode in formatOptions not respected when step is provided #7867

@MarekBodingerBA

Description

@MarekBodingerBA

Provide a general summary of the issue here

When using roundingMode: 'floor' in formatOptions with a step value in NumberField, the rounding mode is not respected when changing values.

🤔 Expected Behavior?

When roundingMode: 'floor' is specified in formatOptions, the value should be floored according to the specified fraction digits, regardless of whether a step value is provided.

😯 Current Behavior

When a step value is provided (e.g., step={0.01}), the roundingMode: 'floor' setting in formatOptions is not respected when changing values. The value appears to use default rounding behavior instead of flooring.

💁 Possible Solution

The formatOptions and NumberFieldProps (like step) shouldn't interfere with each other. I am aware there might be conflicting options that would be hard to solve, but ideally these two aspects of the component would work independently.

🔦 Context

No response

🖥️ Steps to Reproduce

  1. Start with the initial value of 1.236 in both fields
  2. Change the value in the first field (with step)
  3. Observe that the value doesn't respect the floor rounding mode
  4. Compare with the second field (without step) where the rounding mode is respected

CodeSandbox link: https://codesandbox.io/p/sandbox/sleepy-cori-3t8lcx

Version

react-aria-components@1.6.0

What browsers are you seeing the problem on?

Chrome

If other, please specify.

No response

What operating system are you using?

Windows 11

🧢 Your Company/Team

No response

🕷 Tracking Issue

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions