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.

Hide create new option prompt text when input is empty/reset/cleared

See original GitHub issue

Preconditions:

  • multi: true
  • createable: true

Steps:

  1. Type something which will show some of the options, select any of the options.
  2. 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!

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:13
  • Comments:10 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
tonisostratcommented, Mar 9, 2017

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
                            }/>)
}
0reactions
bladeycommented, May 27, 2020

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

text input with clear button which auto hide and show
So, when search box input field is empty it will not show "X". But when the user types anything inside field then "X"...
Read more >
<input>: The Input (Form Input) element - HTML
A single-line text field for entering search strings. Line-breaks are automatically removed from the input value. May include a delete icon in ...
Read more >
Xamarin.Forms Entry - Microsoft Learn
This article explains how to use the Xamarin.Forms Entry class to accept single-line text or password input in an application.
Read more >
UITextField | Apple Developer Documentation
An object that displays an editable text area in your interface.
Read more >
lightning-input-field - documentation - Salesforce Developers
To reset the form fields to their initial values, use the reset() method on each input field. For more information, see lightning-record-edit-form. Overriding ......
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