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)
committerLucas Gass <lucas@bywatersolutions.com>
Wed, 2 Nov 2022 14:37:39 +0000 (14:37 +0000)
commita13002e06e317e7b45f8423f4ad03f0e76684006
treecc0551aadac29d400009e3d01e33d0c95b0f2cfb
parent31ac74eb0cb018d18006e2261fc7735319d54a45
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>
(cherry picked from commit f439537b202cf937616986883d283423211b7bb5)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
koha-tmpl/intranet-tmpl/prog/js/select2.js