question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Getting `opacity: 0` on input after select value

See original GitHub issue

Basically, after selecting a value from the react-select v2 dropdown (basic dropdown 1-1 with single-option html select; e.g., no creating options, no multi-options, etc), the value in the input box disappears because something in react-select v2 is setting the input element itself to opacity: 0.

This only happens for me when the value was non-empty-string when the component first rendered.

I noticed that in the case where a different react-select input but with the same config had an empty-string input value at first render, the issue does not exist.

I worked around simply with an !important css directive to override what react-select v2 is doing.

Sorry, I do not have a reproduction available at this point to share.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:23
  • Comments:12

github_iconTop GitHub Comments

5reactions
jreyes33commented, Apr 15, 2020

If using the new styles API, you can do something like this in the styles prop:

{
  input: (provided) => ({
    ...provided,
    input: {
      opacity: "1 !important",
    },
  }),
}
4reactions
jreyes33commented, May 5, 2020

Yeah, @jakehong0521. If you do it that way, you’re only applying the styles to the containing div, not to the input element itself. Adding the input: {} object in the styles works because it creates a nested selector that targets the actual input element.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Change opacity for select element if option is selected
Now I need to change the opacity to 0.5 for every select element which has a selected option after the page has loaded....
Read more >
react-select option opacity - CodeSandbox
Activating extension 'vscode.typescript-language-features' failed: Could not find bundled tsserver.js.
Read more >
Input and select fields not returning to original opacity - SitePoint
The last value is a level of opacity from zero to one. In the rule above I have set the black (0,0,0) to...
Read more >
opacity - CSS: Cascading Style Sheets - MDN Web Docs
The opacity CSS property sets the opacity of an element. Opacity is the degree to which content behind an element is hidden, and...
Read more >
HTML DOM Style opacity Property - W3Schools
The opacity-level of an element describes the transparency-level, where 1 is not transperant at all, 0.5 is 50% see-through, and 0 is completely...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found