Bug 14880: Keyboard shortcuts don't work after setting CircAutocompl to "Don't try"
authorLari Taskula <larit@student.uef.fi>
Fri, 25 Sep 2015 14:06:40 +0000 (14:06 +0000)
committerChris Cormack <chris@bigballofwax.co.nz>
Fri, 23 Oct 2015 12:54:36 +0000 (01:54 +1300)
commit0ff168c82ce940ef862e1d695c0e3ac66369dbe6
tree40eadd1ef6eaa3ddc7d4f1bd4a97fb14129325f1
parent006a44cc6cc4a25f95d1344318600f8a79f31b5f
Bug 14880: Keyboard shortcuts don't work after setting CircAutocompl to "Don't try"

The issue is that CircAutocompl loads a script element under #header_search
element. When this element is missing, it also messes up the indexing,
because we were calculating the indexing of the found element by subtracting
one from the found element's index (to eliminate the <script> element).

Thats why the shortcut key problem in this bug takes you one too to the left,
because we are still subtracting one from the index even though there is no
<script> element anymore.

This patches selects only the div elements and gets the index from them.
No subtractions needed.

To test keys:
1. Set CircAutocompl system preference to Don't try.
2. Try the shortcut keys. They will work incorrectly like this:
   Alt+U = Search catalogue
   Alt+R = Check out
   Alt+Q = Check in
3. Set CircAutocompl system preference to Try.
4. Try the shortcut keys. They will work correctly like this:
   Alt+U = Check out
   Alt+R = Check in
   ALt+Q = Search catalogue
5. Apply patch
6. Repeat step 1 and 4.
7. Repeat step 3 and 4.
8. Observe that regardless of CircAutocompl, shortcut keys worked correctly.

Followed test plan, works as expected.
Signed-off-by: Marc VĂ©ron <veron@veron.ch>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit d8c0b836d63e54c9a0be6714f0280d3397debdb4)
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
koha-tmpl/intranet-tmpl/prog/en/js/staff-global.js