Bug 14880: Keyboard shortcuts don't work after setting CircAutocompl to "Don't try"
commitd8c0b836d63e54c9a0be6714f0280d3397debdb4
authorLari Taskula <larit@student.uef.fi>
Fri, 25 Sep 2015 14:06:40 +0000 (25 14:06 +0000)
committerTomas Cohen Arazi <tomascohen@theke.io>
Fri, 2 Oct 2015 18:07:30 +0000 (2 15:07 -0300)
tree675ec0db950b9c1929c1cb2054380aa1172e7919
parent431d217a5185af747a8e80080cb1f381585471fc
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>
koha-tmpl/intranet-tmpl/prog/en/js/staff-global.js