Hi, Since 20.11 it is no longer possible to pull down a menu, select and jump to the next field with the tab key when adding an item. You have to click on the drop-down menu. It seems to happen only when adding/editing an item. Tab key works well with borrower module for instance.
If I understand correctly, this is the difference between how an HTML <select> behaves and how a Select2 dropdown (like on additem.pl) works: HTML <select>: 1. Tab to <select>. 2. Use arrow key to highlight option. 3. Hit tab key -> Option is selected. * ENTER key also works. 4. Hit tab key -> Focus moves to next input. Select2 dropdown: 1. Tab to field. 2. Hit ENTER. 3. Use arrow key to highlight option. 4. Hit ENTER -> Option is selected. * TAB key does NOT work to select an option. 5. Hit tab key -> Focus moves to next input. If that's correct, it looks like the tab key difference can be changed by setting a new default in select2.js: "selectOnClose" -> true In terms of having the same number of interactions (key presses or clicks), it would be nice if one didn't have to hit ENTER to activate a Select2 menu. I don't think that's currently configurable.
From a keyboard user perspective may be harder to explain?
I don't understand your comment Marcel. The change would be harder to explain?
(In reply to Owen Leonard from comment #3) > I don't understand your comment Marcel. The change would be harder to > explain? Yeah too short. The fact that one form has a dropdown type A and another one dropdown type B, and you should press X on form A but press Y on form B is harder to explain. For users it may just be a dropdown..
(In reply to Owen Leonard from comment #1) > If that's correct, it looks like the tab key difference can be changed by > setting a new default in select2.js: "selectOnClose" -> true Pierre, does Owen's suggestion answer your need? > In terms of having the same number of interactions (key presses or clicks), > it would be nice if one didn't have to hit ENTER to activate a Select2 menu. > I don't think that's currently configurable. You can open the dropdown list hitting "space" in both situations. So if we turn selectOnClose on, we are good. Am I missing something?
Looks like it can be tested by adding in syspref IntranetUserJS : $(document).ready(function() { $.fn.select2.defaults.set("selectOnClose", "true" ); });
Fridolin, I added this code in IntranetUserJS but it changes nothing for me (still have to click on the menu or hit Enter).
Created attachment 124170 [details] Bug 28903: Tab key and drop-down menu in item module This patch changes the default configuration of Select2 menus so that the tab key can be used to choose an option which has been highlighted using arrow keys. To reproduce the behavior this fixes, open a page with Select2 menus, e.g. additem.pl: 1. Tab to a Select2 field (withdrawn, lost, damaged, etc.) 2. Hit ENTER. 3. Use arrow key to highlight option. 4. Hit TAB -> Option is NOT selected. 5. Hit tab key -> Focus moves to next input. Apply the patch and test again. At step 4 the tab key should work to select the option you've highlighted.
(In reply to pierre.genty from comment #7) > Fridolin, I added this code in IntranetUserJS but it changes nothing for me > (still have to click on the menu or hit Enter). Are you OK with test plan ? For me it is the wanted behavior.
With the patch, the Tab key does now select the option. Thanks !
In 19.11, the arrow keys use to directly pull down the menu - it wasn't necessary to hit Enter. Besides, Tab key use to select the option AND move to next input. Now, it selects the option but stays in the same menu. Would it be possible to easily change this ?
(In reply to pierre.genty from comment #11) > In 19.11, the arrow keys use to directly pull down the menu Confirmed. This appears to be a known bug in Select2: https://github.com/select2/select2/issues/3472.
Proposed fix would select the option if you just hover your mouse cursor over the option and then click outside the box after that --> will cause most definitely unintended changes and was not the previous behaviour.
*** Bug 29558 has been marked as a duplicate of this bug. ***
(In reply to Owen Leonard from comment #12) > (In reply to pierre.genty from comment #11) > > In 19.11, the arrow keys use to directly pull down the menu > > Confirmed. This appears to be a known bug in Select2: > https://github.com/select2/select2/issues/3472. There seems to be a JS snipped type workaround on the github bug - maybe something that could help us here?