Skip to content

NumberField loops if decrement/increment buttons are manually disabled in controlled component #9676

@will-stone

Description

@will-stone

Provide a general summary of the issue here

When clicking on a decrement or increment button that has an explicit isDisabled condition, based on the controlled state value, and you reach that condition, the value change enters a loop and keeps decreasing or increasing respectively.

🤔 Expected Behavior?

The value should decrease/increase to the disable conditions, disable the buttons, and the value remains stable.

😯 Current Behavior

CleanShot.2026-02-18.at.1.41.42.mp4

💁 Possible Solution

No response

🔦 Context

Why am I not using minValue/maxValue? Because I can't use the auto-snap-to-value-on-blur behaviour included with those props. This is because, on e-commerce sites, it's dangerous to automatically change user-input values in case the customer doesn't see the change and accidentally orders too little/much.

To keep using the NumberField component and all the other features it brings, we're not using the minValue, step, and maxValue props, but rather doing our own validation using controlled state.

🖥️ Steps to Reproduce

https://stackblitz.com/edit/a2fkg61d?file=src%2FNumberField.tsx

Version

1.15.1

What browsers are you seeing the problem on?

Firefox

If other, please specify.

Chrome

What operating system are you using?

macOS

🧢 Your Company/Team

RS

🕷 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