[nav-item-dropdown] search box with result dropdown
See original GitHub issueI 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
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:
- Created 6 years ago
- Comments:8 (8 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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)?
Glad we could help out some!