kartik-v/yii2-widget-select2

Can't reach input search field

strtob opened this issue · 3 comments

Hi,

I use the wiget in a modal window, no tabindex is defined in modal tag. The select2 open and show values, if you hover over the search field, the the cursor change, but after a click the cursor don't move in the search field and you cannot input any data - it won't be selected.

Any ideas? :-/

if you are using bootstrap modal, just remove tabindex="-1" from the bootstrap modal attribute and it will work. it's work for me

Thank you for your help. I use bootstrap 4 modal, like this (already without tabindex="-1"

<div id="modal" class="fade modal" role="dialog" aria-hidden="true" aria-labelledby="modal-label">
<div class="modal-dialog modal-xl" role="document">
<div class="modal-content">
<div id="modal-header" class="modal-header">
<h5 id="modal-label" class="modal-title">title</h5>
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span></button>
</div>
<div class="modal-body">
 
    <div id="modal-content-message"></div>
    <div id="modal-content-details">
        <div style="text-align:center">
            <div style="text-align:center"><span class="spinner-border text-primary m-1" role="status"></span> Loading Data...</div>
        </div>
    </div>    
    
</div>

</div>
</div>
</div>    

crazy, sometimes it works normal, sometimes not :-( (at the same form)

in my case, this helpfs:

$(function() {
        
        $.fn.modal.Constructor.prototype._enforceFocus = function() {};

}