Clicking on search bar closes Select2 when used inside TablEdit

Hi,

I managed to use Select2 to replace a very large dropdown inside a Tabledit element.

It works very well, except for the search bar : when I left-click on the search bar, Select2 closes. However, when I middle-click and then left-click, I am able to write in the search bar (I can also right-click and paste text). Can you help me to use left click on the search bar ?

Here is an extract of my twig :

<td class="tabledit-view-mode" style="cursor: pointer;border: 1px solid #959595;"> <select class="tabledit-input form-control usage-selector" id="usage_{{ lignes.id_trt }}" name="usage_{{ lignes.id_trt }}" style="display: none;" disabled="" onChange="change('usage',{{ lignes.id_trt }},{{ lstval.getId }},this.value);"> <option value="" ></option> {% for produit in lstproduit %} {% if lignes.position_trt == produit.position and lignes.cible == produit.cible %} {% set selected = '' %} {% if lignes.position_trt == produit.position and lignes.cible == produit.cible and lignes.uuid is not null and lignes.uuid == produit.uuid %} {% set selected = 'selected' %} {% endif %} {% if produit.nb_nom > 1 %} <optgroup label="{{ produit.nom }} - dose max. : {{ produit.dose_maximale_homologuee }} {{ produit.unite }} - ZNT Aqua. : {{ produit.znt_aquatique }}"> {% endif %} <option value="{{ produit.uuid }}" {{ selected }}>{{ produit.nom }}</option> {% if produit.nb_nom > 1 %} </optgroup> {% endif %} {% endif %} {% endfor %} </select> </td>