Skip to content

Type to search appears even there is no match for search term when autoFocus is true. #479

@rushijagani

Description

@rushijagani

Version

16.7.0

Steps to reproduce

<AsyncTypeahead
    autoFocus={true}
    {...tProps}
    ref={typeahead => {
        this.typeahead = typeahead;
    }}
    className={search && 'search'}
    onSearch={this.handleSearch}
    onChange={this.handleChange}
    onBlur={this.onBlur}
    onFocus={this.onFocus}

/>
componentWillReceiveProps(props) {
    const { value } = props;
    if (value !== selected) {
      this.typeahead && this.typeahead.getInstance().focus();
    }
  }

When the input field is auto-focused let's say it has already "asdasdasd" search term then it is showing the "Type to search..." ideally it should display "No matches found."
it is working as expected then there is a match search term and results.

After focus it I change anything then the "No matches found." message appears

  1. Initially when there are search term and auto-focus is triggered
    Screenshot (34)

  2. if I update the input then it shows the correct message "No matches found."
    Screenshot (35)

Expected Behavior

When the typehead is focused and there is already "asdasda" search term with no match results then it should display the No Match message instead of the "Type to search..."

Actual Behavior

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions