cca / koha_snippets

code to be pasted into Koha's admin side
https://library.cca.edu
Other
4 stars 0 forks source link

patron autocomplete does allow keyboard select #14

Closed phette23 closed 4 years ago

phette23 commented 4 years ago

In this gif I'm pressing Enter first & then spacebar; neither selects the highlighted autocomplete item (the highlighting in effect does nothing): patron autocomplete

The autocomplete implementation appears to be a <script> tag on the page:

<script type="text/javascript">
         $(document).ready(function(){
             var obj = $( "#findborrower" ).autocomplete({
                 source: "/cgi-bin/koha/circ/ysearch.pl",
                 minLength: 3,
             }).data( "ui-autocomplete" );
             if( obj ) {
                 obj._renderItem = function( ul, item ) {
                     var cardnumber = "";
                     if( item.cardnumber != "" ){
                         // Display card number in parentheses if it exists
                         cardnumber = " (" + item.cardnumber + ") ";
                     }
                     return $( "<li></li>" )
                     .data( "ui-autocomplete-item", item )
                     .append( "<a href=\"/cgi-bin/koha/circ/circulation.pl?borrowernumber=" + item.borrowernumber + "\">" + item.surname + ", " + item.firstname + cardnumber + " <small>" + item.dateofbirth + " " + item.address + " " + item.city + " " + item.zipcode + " " + item.country + "</small></a>" )
                     .appendTo( ul );
                 };
             }
         });
     </script>
phette23 commented 4 years ago

Koha bug #23518