After tackling my previous issue on Stack Overflow, I stumbled upon a new question that has been bothering me.
The problem arises when users click on the arrow to reveal advanced search options, as the form drops down as expected. However, when a user clicks on a select dropdown menu, the entire menu collapses unexpectedly.
I have been attempting to identify the element or trigger causing this problem and find a workaround, but so far, I have made no progress.
Here are my observations:
- [Expected] Clicking outside the dropdown area should collapse the menu
- [Unexpected] Clicking on any white space inside the dropdown still collapses the menu
- [Expected] Users should be able to type in and enter required text when clicking on the text field, checkbox, radiobox, or textarea
- [Unexpected] Clicking on a select menu instantly collapses the dropdown
Below is a sample code to illustrate the issue I am facing.
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
<div class="container">
<div class="row">
<div class="col-12">
<div class="input-group dropdown">
<input type="text" class="form-control" id="project_search" placeholder="search ...">
<div class="input-group-append">
<div class="btn-group">
<button class="btn bg-primary text-white" type="button">Search</button>
<button class="btn bg-primary text-white dropdown-toggle dropdown-toggle-split" id="searchAdvancedFilter" data-toggle="dropdown" data-boundary="window" aria-haspopup="true" aria-expanded="false">
<span class="caret"></span>
<span class="sr-only">Toggle Dropdown</span>
</button>
<div class="dropdown-menu dropdown-menu-right p-3 w-100" aria-labelledby="searchAdvancedFilter">
<h6 class="dropdown-header">Advanced Settings</h6>
<div class="dropdown-divider"></div>
<div class="form-group">
<label for="option">Option Header</label>
<select class="form-control" id="option" name="option">
<option>Pick an option</option>
<option value=1>Option 1</option>
<option value=2>Option 2</option>
</select>
</div>
<div class="form-group">
<label for="inputtext">Input Header</label>
<input type="text" class="form-control" id="inputtext" name="inputtext">
</div>
<div class="form-group">
<label for="inputcb">Checkbox Header</label>
<input type="checkbox" class="form-control" id="inputcb" name="inputcb">
</div>
<div class="form-group">
<label for="inputradio">Radio Header</label>
<input type="radio" class="form-control" id="inputradio" name="inputradio">
</div>
<div class="form-group">
<label for="ta">TextArea Header</label>
<textarea class="form-control" id="ta" name="ta"></textarea>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>