Hide create new option prompt text when input is empty/reset/cleared
Preconditions:
- multi: true
- createable: true
Steps:
- Type something which will show some of the options, select any of the options.
- Input is cleared on selecting option but the prompt text
Create an option "xxx"is still there when you focus on the field. The same happens when you type something and click outside of the select container (blur) and focus on it again.
It would be great if the prompt text Create an option "xxx" will not display when the input is empty/reset/cleared as it's kinda strange to display suggestion to create new option when there is nothing in the input. Thanks!
+1
+1
A quick (and dirty?) workaround currently is to manually delete the internal placeholder item whenever onChange() fires.
Here's an example using a stateless component:
export default props => {
let ref;
return (<Select.Creatable ref={el => ref = el}
onChange(values => {
delete ref._createPlaceholderOption;
//resume handling the values
}/>)
}
@tonisostrat why not simply hide element based on its class .Select-menu-outer .Select-create-option-placeholder { display: none; }
Because that only hides it visually. It's still persisted inside the <Select/> and may affect the behaviour of the whole field in regards to filtering the drop-down and item creation/selection.
+1
+1
+1!
@tonisostrat Your workaround doesn't work for me :(
To me, this is fixed with #1306. Close?
Hello -
In an effort to sustain the react-select project going forward, we're closing old issues / pull requests.
We understand this might be inconvenient but in the best interest of supporting the broader community we have to direct our limited efforts to maintain the latest version.
If you feel this issue / pull request is still relevant and you'd like us to review it, please leave a comment and we'll do our best to get back to you.