Using material UI (verison: ^4.12.3
) Select, with a customized input has led to an unexpected issue in the production environment. The Select input in prod has a black background and a :before
element with a white background that I didn't intend to have.
I'm unsure where this styling is coming from, as it's not present in my development environment. Upon comparing the CSS & HTML of both environments' Select elements, I noticed that there is a ::before
element added in the prod version but not in dev.
Additionally, the background color differs between the two versions. In prod, there is a supplementary class applied to the InputBase element which adds a black background color:
Edit 1
It appears that MUI injects <style>
. In the production HTML code, I can see the unwanted styles such as background-color: black
and the ::before
element. Despite my attempts to apply inline styles to override these injected styles, I've faced difficulty especially with the ::before
element. Is there a way to disable these injected styles or find a workaround?
This is image illustrating the injected bad css: