DevoInc / genesys-ui

Monorepo containing the codebase for the Genesys UI components library.
https://devoinc.github.io/genesys-ui/
MIT License
2 stars 0 forks source link

Checkbox component doesn't take into account the prop value "checked" #70

Closed adrianfega closed 1 month ago

adrianfega commented 2 months ago

What steps will reproduce the bug?

If the checked prop is set as true and the checkbox is not checked nothing happened, and viceversa, if it’s default checked and checked prop is put as false nothing happens too. It’s reproducible in the storybook.

How often does it reproduce? Is there a required condition?

No special condition is required

What is the expected behavior? Why is that the expected behavior?

The expected behaviour is that the checkbox is checked or not according to the value of the prop checked

What do you see instead?

That nothing happens when the checked prop value is changed

Additional information

No response

adrianfega commented 2 months ago

After analyze the code I came to the conclusion that if you pass the prop onChange then it works, this is related with this line of code, checked is only applied if onChange is defined: checked={onChange ? checked : undefined}

Instead of onChange I was using onClick that apparently did the same, and because of this I had this problem. Maybe could be not considered as a bug, but I think that maybe we can improve the doc, or put onChange prop as required.