react-select icon indicating copy to clipboard operation
react-select copied to clipboard

[v2] Input text overflow

Open dbertella opened this issue 8 years ago • 6 comments

is this the expected behaviour for the input with a very long text? screen shot 2018-07-04 at 15 22 27

To reproduce just go to the page with example and type a very long text

dbertella avatar Jul 04 '18 14:07 dbertella

@dbertella I have a CSS hack to get around this, wrap your Select in a div and set CSS for the container's input to have a max-width. I tried adding this max-width in the input on styles props, but it did not work.

<div className="selectContainer">
    <Select ... />
</div> 

//CSS
.selectContainer input {
  max-width: 400px; //whatever width you need
}

lusa avatar Jul 05 '18 19:07 lusa

https://vgy.me/cxBWTs.png

@dbertella I have a CSS hack to get around this, wrap your Select in a div and set CSS for the container's input to have a max-width. I tried adding this max-width in the input on styles props, but it did not work.

Cuz we have inline style change onInputing.

My hack is using !important for .Select-input >input, and setting width and max-width for .Select-input and for Select-multi-value-wrapper . Also I set display: flex for Select-multi-value-wrapper ( using display: table in 2k18, omfg)

yanpolonskiy avatar Jul 06 '18 04:07 yanpolonskiy

This works for me for v2 (including in IE 11) (note: "prefix" is the classNamePrefix)

.prefix__value-container {
  width: 90%;
}
.prefix__value-container--is-multi.prefix__value-container--has-value.prefix__value-container {
  width: 85%;
}
.prefix__value-container > div,
.prefix__input,
.prefix__input > input {
  max-width: 99%;
}
.prefix__input > input + div {
  max-width: 100%;
}

TheSharpieOne avatar Jul 10 '18 16:07 TheSharpieOne

Just to 👍 this even harder:

If your application uses CSS modules exclusively, hacking this to fix it is even more insane.

Had to resort to overriding style objects with flexbox and using nested CSS selectors like div[style*='inline-block;'] to get it to work.

jrhalchak avatar Sep 06 '18 17:09 jrhalchak

Resolved by #2876

jossmac avatar Sep 21 '18 05:09 jossmac

For me work this

  input: (styles) => ({
    ...styles,
    overflow: 'hidden',
    textOverflow: 'ellipsis',
    whiteSpace: 'nowrap',
  }),

Gian-Marco-27 avatar Mar 23 '23 16:03 Gian-Marco-27