reactjs / react-autocomplete

WAI-ARIA compliant React autocomplete (combobox) component
MIT License
2.17k stars 532 forks source link

Autocomplete max-width #330

Closed Prophet32j closed 6 years ago

Prophet32j commented 6 years ago

If the items of the menu div extend past the width of the parent input, the div will overflow into other parts of the page. What would be the impact of adding a max-width to the styles object, effectively doing max-width = min-width?

If the autocomplete bumps up to the edge of the browser, it automatically wraps.

Prophet32j commented 6 years ago

got it. Pretty simple too.

const renderMenu = (items, value, style) => {
  style.maxWidth = style.minWidth;
  <div style={style}>
    {items}
  </div>
}