In Koha 21.11.x and maybe earlier, when clicking on a field that is a dropdown in the cataloguing editor, the input search field would focus automatically, putting the cursor in the box so you can start typing right away. Since 22.05.x, this no longer happens. When you click the dropdown and it opens, you need to click again into the input search field in order to start typing. This happens in upstream as well, the most recent version where it worked was 21.11.x. So it must've broken in 22.05.x. To reproduce: 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
*** Bug 31429 has been marked as a duplicate of this bug. ***
Do we want all dropdowns with a select2-search__field to move focus to the search input? With the 942$c it makes a lot of sense. But maybe with the fields like 942$n ( Suppress in OPAC ) which is a yes/no we would want the focus to stay on the dropdown options so the user can use the keyup and keydown to select either yes/no.
I think yes we do want it to move to the search input. They can still search Y or N to get to those yes/no options.
Created attachment 141175 [details] [review] 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.
Hi Lucas, please don't forget to set Assignee, thx!
Created attachment 141293 [details] [review] 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>
Created attachment 141492 [details] [review] 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>
Nice improvement, works as described. Passing QA
Pushed to master for 22.11. Nice work everyone, thanks!
Backported to 22.05.x for upcoming 22.05.07 release
applied to 21.11 for 21.11.14
Not backported to oldoldstable (21.05.x). Feel free to ask if it's needed. Nothing to document it seems, marking resolved.