Skip to content

Incorrect value decremented when step > minValue for counter Input #2034

Open
@rk-sf

Description

@rk-sf

Summary:

When counter input set to max value, then decremented with step > minValue, first decrement is maxValue - (step - minValue) instead of just maxValue - step.
eg.
maxValue=1000
minValue=2
step=100
value=1000
decrement()
// value == 902 == 1000 - (100 - 2) == maxValue - (step - minValue)

  • If you are working on the problem. Issues may be closed within 30 days if no one is assigned. Maintainers work on this project 20-30 hours per week and have their own prioritized backlog.

I'll likely not be working on the issue.

  • How to duplicate a bug. Line numbers or code to paste into the documentation site examples is helpful.

Reproducible from the example page: https://react.lightningdesignsystem.com/components/inputs/

  1. Navigate to section containing: "3. CONTROLLED COUNTER INPUT WITH MIN/MAX VALUES AND CUSTOM STEP SIZE"
  2. Modify Example Code
  3. Update counter-input-3 with
    <Input
        id="counter-input-3"
        label="My Label"
        minValue={2}
        maxValue={1000}
        onChange={(event, data) => {
            this.setState({ counter3value: data.value });
        }}
        step={100}
        value={this.state.counter3value}
        variant="counter"
    />
  4. Navigate back to the relevant input.
  5. Set value to 1000
  6. Decrement
  7. Note resulting value is 902 instead of 900
  • If you are a Salesforce employee. You should also create a duplicate work item in your internal ticket system and link to this issue.

I'll go ahead and add a ticket

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions