For those having issues even with tabIndex removed and all other normal solutions exhausted this is something to consider as it was an intermittent issue and hard to diagnose.
I use Yii2 and Kartik Select2 widget in a bootstrap modal which makes it hard to override the dedropdownParent setting. The widget worked perfectly in most situations anyways so I think he sets it correctly.
If the modal content container does not have a max-height and overflow-y:scroll style settings the select2 was not allowing search functionality when the modal content grew beyond the original modal size. After doing many tests and then some research on the symptoms its clear that there is a scroll detector function in the select2 initialization that breaks if it "thinks" the content should have a scroll even if it doesn't.
To fix this issue I set the modal-content max-height to 75vh and overflow-y:scroll. This way the select2 scroll detection will actually work and the search function will initialize.