Giter VIP home page Giter VIP logo

Comments (4)

snowystinger avatar snowystinger commented on June 11, 2024

Thanks for the issue, this is working as expected.
https://react-spectrum.adobe.com/react-spectrum/NumberField.html#step-values
https://html.spec.whatwg.org/multipage/input.html#the-step-attribute
https://jsfiddle.net/aur2qmx9/2/

I suggest using min = 1 if you do not want people to use 0. As is, with step, you cannot enter a number less than 1 in your scenario. Try entering a decimal value into these examples, they will all be snapped to the step.
https://react-spectrum.adobe.com/react-spectrum/NumberField.html#step-values

from react-spectrum.

lxfschr avatar lxfschr commented on June 11, 2024

Thanks for your prompt response @snowystinger. I can see how this implementation applies to the spec for step. However, in my use case, which is a design tool, precision is important to our users. They need to be able to enter in exact values and see those exact values applied. In addition, it would be useful to be able to step through values at a reasonable increment when using steppers. For example, imagine a designer designing in centimeters. A reasonable step for centimeters might be 1 centimeter, when using the keyboard to scroll wheel to scrub on number fields. However, the minimum allowed value shouldn't be a centimeter, as even when working in centimeters you might have something that is half a centimeter or even a meter. As in, do you have any way to allow this behavior when using spectrum components?

from react-spectrum.

snowystinger avatar snowystinger commented on June 11, 2024

I see what you're saying. A detached step value that does no "snapping". We don't currently support that.

I'm not sure there is a good way to do it without also allowing a user to supply the origin (ordinarily the min) as well. We'd also have to make whatever options be mutually exclusive. Specifying both a step and a detached step would be a conflict.

I'll bring it to the team and see if it's something we want to support.

from react-spectrum.

snowystinger avatar snowystinger commented on June 11, 2024

The general feeling is that this would be ok, contingent on the API. If you'd like to contribute a PR or an RFC https://react-spectrum.adobe.com/contribute.html#feature-requests then that'd move the discussion along.

from react-spectrum.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.