title: Select2 — Making a custom select element using select2’s amd.require api
body: <p>I am trying to create a custom select2 dropdown element that will:</p>
  
  <ul>
  <li>have a search field</li>
  <li>will close once an option is selected</li>
  <li>will not flip its position relative to the element that opens/closes the dropdown (i.e. that pane with the arrow down that you click)</li>
  </ul>
  
  <p>Basically, I love the default behavior of select2 apart from that position flipping when the dropdown tries to adjust to the visible area below the select2 element. I want select2 to <strong>always</strong> open downwards. So after searching that's the only solution I could find (using the latest version of select2, which at the moment is 4.0.1):</p>
  
  <pre><code>        $.fn.select2.amd.require([
              'select2/utils',
              'select2/dropdown',
              'select2/dropdown/attachContainer',
              'select2/dropdown/closeOnSelect',
              'select2/dropdown/search'
          ], function (Utils, DropdownAdapter, AttachContainer, CloseOnSelect, DropdownSearch) {
  
              CustomAdapter = Utils.Decorate(
                  Utils.Decorate(
                      Utils.Decorate(
                          DropdownAdapter,
                          DropdownSearch
                      ),
                      CloseOnSelect
                  ),
                  AttachContainer
              );
  
              this.select.select2({
                  dropdownAdapter: CustomAdapter
              });
          }
  </code></pre>
  
  <p>It almost works. But now I don't have a cursor blinking in the search field when I open the dropdown. Clicking on the search field also won't show the cursor, although typed characters will show up in the search field, and the search itself works.</p>
  
  <p>This absense of a visual cue for the user that he can start typing is incredibly annoying, but I can't figure out how to solve it. Could you help me? Or, failing that, maybe you know of a way to prevent this flipping behavior without ugly hacks and without re-building select2 on the fly?</p>
  
  <p><strong>UPDATE:</strong> Ok, I think there must be some deeper underlying problem on my side, because this absence of focus on the search field is happening even when using a normal full-featured select2.</p>