From 30e7b94e7c156f43cfba655d4714486687d94970 Mon Sep 17 00:00:00 2001 From: Dan Briem Date: Fri, 4 Oct 2019 10:57:06 -0400 Subject: [PATCH] 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 Signed-off-by: Jason Etheridge --- Open-ILS/src/templates/opac/parts/place_hold.tt2 | 5 ++--- Open-ILS/web/js/ui/default/opac/staff.js | 25 ++++++++++++++++------ .../web/js/ui/default/staff/cat/catalog/app.js | 2 +- 3 files changed, 21 insertions(+), 11 deletions(-) diff --git a/Open-ILS/src/templates/opac/parts/place_hold.tt2 b/Open-ILS/src/templates/opac/parts/place_hold.tt2 index c359157320..ee1dc03a57 100644 --- a/Open-ILS/src/templates/opac/parts/place_hold.tt2 +++ b/Open-ILS/src/templates/opac/parts/place_hold.tt2 @@ -110,9 +110,8 @@ function maybeToggleNumCopies(obj) { + onpaste="return debounce_barcode_change(event)" + onkeydown="return debounce_barcode_change(event)" autofocus />