LP#1778606 Web Client - Place Hold Requires Two Clicks on Submit
authorDan Briem <dbriem@wlsmail.org>
Fri, 4 Oct 2019 14:57:06 +0000 (10:57 -0400)
committerChris Sharp <csharp@georgialibraries.org>
Wed, 19 Aug 2020 15:03:59 +0000 (11:03 -0400)
commit30e7b94e7c156f43cfba655d4714486687d94970
tree1924afb51fcb26b7d49cd3d958b0225180294232
parent45d8790998ab7ba9e19c4b7ff4fd131cd6d83678
LP#1778606 Web Client - Place Hold Requires Two Clicks on Submit

Issue: the barcode lookup runs on the input's onchange, onkeypress (Enter), &
disables the submit button until the patron loads. So, if you type a barcode,
click enter, click the submit button, mousedown fires, if focus was still the
barcode input, its onchange fires, the lookup runs again, the submit button
disables, prevents button mouseup from firing, the click event is disrupted, &
the form doesn't submit. Click again & it works.

Instead of onchange & onkeypress this branch runs the lookup when there's a
500ms pause between onkeydowns. onpaste and enter still run the lookup
immediately. The patron search triggers the input's keydown instead of change.

To test:
1. Search for any holdable item in the catalog and click Place Hold
2. Type in an existing patron barcode and click Enter
3. Before tabbing or clicking off the barcode input, click the Submit button
4. Note it doesn't submit - click again and it submits
5. Apply patch
6. Repeat steps 1-3
7. Note it submits

Signed-off-by: Dan Briem <dbriem@wlsmail.org>
Signed-off-by: Jason Etheridge <jason@EquinoxInitiative.org>
Open-ILS/src/templates/opac/parts/place_hold.tt2
Open-ILS/web/js/ui/default/opac/staff.js
Open-ILS/web/js/ui/default/staff/cat/catalog/app.js