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.

[nav-item-dropdown] search box with result dropdown

See original GitHub issue

I am trying to add a search box in my menu bar with a popover dropdown menu. Unfortunately because of the a-tag that’s always there I am getting some unexpecting results.

My current template is:

<b-nav class="pull-right">
  <b-nav-item-dropdown right noCaret>
    <b-input-group slot="button-content">
      <b-form-input slot="left" v-model="searchText" placeholder="search"></b-form-input>
     
      <div slot="right" class="btn btn-primary"><i class="fa fa-search"></i></div>
    </b-input-group>

    <b-popover>
      <div >
        <b-dropdown-header>no results found</b-dropdown-header>
      </div>
    </b-popover>
  </b-nav-item-dropdown>
</b-nav>

which looks like image

Using the git version of bootstrap-vue this all works mostly well, except that now when I click in the input field to enter my search terms, the popup is immediately opened and focus is set on the dropdown-menu. This means I can’t type anything in the search box unless I click the input field again. Any recommendations what the best way to solve this?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
tmorehousecommented, Jul 6, 2017

Yeah, It might be best that you generate a custom component for this type of application, rather than use one of the dropdown flavours, which were designed primarily as menus (which have keyboard navigation features which rely on a particular structure and set of subcomponents)., and nav-item-dropdown typically expects itself to be a direct child of a nav or navbar (based on BS V4 CSS).

But I think you are off to good start. I’m curious as to how it works when the navbar collapses on smaller screens (or is your navbar non-collapsing)?

0reactions
tmorehousecommented, Jul 6, 2017

Glad we could help out some!

Read more comments on GitHub >

github_iconTop Results From Across the Web

How TO - Search/Filter Dropdown - W3Schools
Learn how to search for items in a dropdown menu with CSS and JavaScript. ... class="dropdown-content"> <input type="text" placeholder="Search.
Read more >
Bootstrap Select dropdown with search - free examples & tutorial
Responsive Select dropdown with search built with Bootstrap 5. Helps you find the options you are looking for by searching.
Read more >
How to set dropdown and search box in same line using ...
The main aim is to align the dropdown menu and search box in a straight line. Example 1: We will create a navigation...
Read more >
Dropdowns - Bootstrap
For instance, it is possible to create dropdowns that contain additional inputs and form controls, such as search fields or login forms.
Read more >
Search bar with dropdown list - javascript - Stack Overflow
This is a working demo of your attempt of filtering the menu items in real time by typing suggestions on the input text....
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