After creating a component called "SliderBox", I noticed that it returns a div containing a Material UI Slider with createMuiTheme and an input component.
The "SliderBox" component utilizes an onHover method on the parent div to change the component's color state. The issue arises when this function is applied to one instance of "SliderBox", causing the color change to affect every "Slider". Despite being managed internally, the color change does not extend beyond the "SliderBox" component.
In Picture A, you can see three "SliderBox" components in their initial state.https://i.sstatic.net/SnqGt.png
Picture B shows the same three components, with the topmost component hovered over. It appears as though the color shift affects all three "Slider" components but not their container, "SliderBox".https://i.sstatic.net/TMQJ4.png
Potential Solutions Various attempts were made to rectify this issue, such as assigning unique key values to both "SliderBox" components and implementing Math.random() to no avail.
An alternative solution involved assigning a unique key value using props.sliderKey to each "SliderBox" component, which did not produce the desired outcome.
Separating the "Slider" component from the "SliderBox" component resulted in minor changes like flickering color values, yet the problem persisted with shared values among all Slider components.
Adding a base "Slider" component to the highest-level parent element integrating "SliderBox" led to styles applied within the child of "SliderBox" influencing the "Slider" component in the parent element.
Insights The root cause seems to stem from the implementation of createMuiTheme in the "SliderBox" component, which cannot be altered due to its critical role in customizing thumb text color.
This issue may also be attributed to the imported component from '@material-ui/core', where potential lack of uniqueness or key application results in color bleed across multiple "Slider" instances.
Personal Reflections While considering potential resolutions like incorporating my Slider within a JavaScript class extending a component, unfamiliarity with this practice may hinder progress. Seeking guidance from experienced users who have tackled similar challenges could expedite resolving this recurring issue.