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

cds-number component (carbon-components-angular v4.75.6) [min] and [max] limitation does not work when entering a number from the keyboard. #2743

Open
rulvalery opened this issue Dec 12, 2023 · 1 comment
Labels
component: Number For Number issues

Comments

@rulvalery
Copy link

You can limit the number you increase and decrease with the buttons using [min] and [max], but this limitation does not work when entering a number from the keyboard.

Suggested solution:
Why not, if the user enters a number greater than [max] replace that number with [max] and, if the user enters a number less than [min], replace it with [min]?

@Akshat55
Copy link
Contributor

We avoid implementing logic such as the solution you've recommended to keep the component flexible. We don't want developers to wonder what magic is happening under the hood as it can be an unwanted behavior by users which can greatly increases maintenance.

You can still achieve this by listening for the value change and updating your ngModel binded variable accordingly. Should be possible with both template-drive and reactive forms.

@Akshat55 Akshat55 added the component: Number For Number issues label Jan 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: Number For Number issues
Projects
None yet
Development

No branches or pull requests

2 participants