Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Кнопки + - не работают(заблокированы) NumberInput #1229

Closed
smff opened this issue Jan 29, 2024 · 3 comments
Closed
Assignees
Labels
bug Something isn't working

Comments

@smff
Copy link

smff commented Jan 29, 2024

"@admiral-ds/react-ui": "7.8.4",

<NumberInput
      value={0}
      onChange={props.onChange}
      maxValue={2000}
      readOnly={props.readOnly}
      minValue={0}
      precision={0}
      suffix=""
      dimension="s"
      placeholder="0"
    />
    ```

    При такой отрисовке кнопки + - не работают(заблокированы) 
    
    Кажется это из за того, что внутри NumberInput на 166 идет проверка if(innerValue) которая не учитывает, что 0 это допустимое число
@DrUNE DrUNE self-assigned this Jan 29, 2024
@DrUNE DrUNE added the bug Something isn't working label Jan 29, 2024
@DrUNE
Copy link
Contributor

DrUNE commented Jan 29, 2024

При использовании кнопок + - если значение доходит до 0 происходит блокировка
https://stackblitz.com/edit/github-nbz5v2?file=src%2FApp.tsx

@smff
Copy link
Author

smff commented Jan 29, 2024

Я про это и говорю. Вы это целенаправленно сделали?
IMAGE 2024-01-29 16:21:28

Если innerValue проверить на 0 (как number) и с учетом всех min/maxValue - то можно получить, что пользователь может через - дойти до 0 и потом через + подняться выше.
А сейчас получается, дойдя до нуля у него блокируются кнопки и что бы продолжить пользоваться нужно руками вводить число

upd: если нуль передавать строкой '0' оно работает.

@DrUNE
Copy link
Contributor

DrUNE commented Jan 30, 2024

#1230

@DrUNE DrUNE closed this as completed Jan 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

When branches are created from issues, their pull requests are automatically linked.

2 participants