Closed RVMendoza closed 4 years ago
Hello @RVMendoza , could I solve this issue for hacktoberfest2020? Thank you!
@Kalovelo go for it!
Thank you for your help with this @Kalovelo !
This will be on the next release!
Thank you for your help with this @Kalovelo !
This will be on the next release!
Thank you for the opportunity ♥️
Describe The Bug
If you were to put two Toggles on the same page, they would not have unique Ids, even though they are being set on defaultProps (which is the problem).
We cannot use
uniqueID()
ondefaultProps
becausedefaultProps
is a static property, which means it doesn't change on every new class.This makes sense because if the value is different on every instance of the class, it wouldn't be considered default, and in your case, it shouldn't be.
Source: https://stackoverflow.com/questions/57628582/reactjs-difference-between-generates-a-unique-id-via-default-props-and-state
React Components Affected:
To Reproduce
Steps to reproduce the behavior:
id
s and corresponding accessibility attributes are all the sameExpected Behavior
If multiple components exist on the same page, their ID and accessibility attribute pairing should be unique to each instance.