LP#1778606 Web Client - Place Hold Requires Two Clicks on Submit user/dbriem/lp1778606_place_hold_click_twice
authorDan Briem <dbriem@wlsmail.org>
Fri, 4 Oct 2019 14:57:06 +0000 (10:57 -0400)
committerDan Briem <dbriem@wlsmail.org>
Fri, 4 Oct 2019 14:57:06 +0000 (10:57 -0400)
commit6452a11d2404fbbb057e248151fb5fd25f41d805
treef08190e9891063982c5b240933938cf5ee5f506f
parent1a6b9caf74f59485d34665597e489bd93b19b904
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>
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