Bug 31646: Add Select2 focus to text search field
authorLucas Gass <lucas@bywatersolutions.com>
Fri, 30 Sep 2022 17:48:25 +0000 (17:48 +0000)
committerTomas Cohen Arazi <tomascohen@theke.io>
Tue, 11 Oct 2022 13:16:35 +0000 (10:16 -0300)
commitf439537b202cf937616986883d283423211b7bb5
treef4ce75035a9d21fac50baa0c9ac2f729e04d0310
parentb3ffd2cc02166f3264376ace1038df4f83bf8118
Bug 31646: Add Select2 focus to text search field

To test:
1. Edit a biblio record
2. Go to tab 9 to find the item type MARC field 942$c
3. Click on the field to select an item type
4. Notice you have to click again on the search field to begin typing to search
   for your item type
5. Apply patch/clear browser cache
6. Try steps 2-3 again, the focus should now be on the search text field
7. Try another select2 dropdown on the same page like the  942$n ( Suppress in
   OPAC ), it should also default to the text search field.
8. Try other places in Koha that feature this kind of select2, like when
   placing hold.

Note: Using $(document).on here instead of $(".select2").on becuase there are
several instances where there are more than 1 select2 dropdown on a single page.
This allows for the text search field to default each time you click on a
different dropdown.

Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
koha-tmpl/intranet-tmpl/prog/js/select2.js