Bug 32420

Summary: Set focus for cursor to barcode input box in batch item modification
Product: Koha Reporter: Caroline Cyr La Rose <caroline.cyr-la-rose>
Component: Staff interfaceAssignee: Bugs List <koha-bugs>
Status: Patch doesn't apply --- QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: gmcharlt, Laura.escamilla, lucas
Version: unspecified   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:
Attachments: Bug 32420: Set focus for cursor to barcode input box in batch item modification
Bug 32420: Set focus for cursor to barcode input box in batch item modification
Bug 32420: (follow-up) Set focus for cursor to barcode input box in batch item modification

Description Caroline Cyr La Rose 2022-12-07 16:41:19 UTC
It would be great if the focus would be automatically set to the barcode input box in the batch item modification screen.

Right now, the focus is on the catalogue search. But if you went to that page, you went to batch edit item. 

To test:
1. Go to Cataloging > Batch item modification
   --> Notice that the cursor is set to the 'Search catalog' box at the top of the page, it would be better to have it in the barcode input box under 'Scan items one by one'
Comment 1 Paul Derscheid 2022-12-16 10:28:34 UTC
Created attachment 144642 [details] [review]
Bug 32420: Set focus for cursor to barcode input box in batch item modification

This should do it. Don't know whether it's compatible with the JS guidelines in the wiki.
But I don't know whether it makes that much sense to move this block to
one of the included scripts.

To test:
1. Go to Cataloging > Batch item modification
	--> The barcodelist input field is now selected by default in
the 'batch item modification' as well as the 'batch item deletion' view.

https://bugs.koha-community.org/show_bug.cgi?id=32418
Comment 2 Lucas Gass (lukeg) 2022-12-16 16:52:14 UTC
Created attachment 144694 [details] [review]
Bug 32420: Set focus for cursor to barcode input box in batch item modification

This should do it. Don't know whether it's compatible with the JS guidelines in the wiki.
But I don't know whether it makes that much sense to move this block to
one of the included scripts.

To test:
1. Go to Cataloging > Batch item modification
	--> The barcodelist input field is now selected by default in
the 'batch item modification' as well as the 'batch item deletion' view.

https://bugs.koha-community.org/show_bug.cgi?id=32418

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Comment 3 Katrin Fischer 2022-12-28 21:52:25 UTC
Hi Paul, thx for the patch!

Your patch works, but there is a standard way to achieve this, that is a little nicer:

-                                      <textarea rows="10" cols="30" id="barcodelist" name="barcodelist"></textarea>
+                                      <textarea class="focus" rows="10" cols="30" id="barcodelist" name="barcodelist"></textarea>

By adding the class 'focus' some magic will happen :)
Comment 4 Paul Derscheid 2024-04-13 12:30:24 UTC
Created attachment 164866 [details] [review]
Bug 32420: (follow-up) Set focus for cursor to barcode input box in batch item modification

Patch now uses cait's suggestion: the `focus` class.

To test:
1. Go to Cataloging > Batch item modification
2. Check that the barcodelist textarea isn't focused by default.
3. Apply patch.
4. Go to Cataloging > Batch item modification
5. Check that the barcodelist textarea is now selected by default in
the 'batch item modification' as well as the 'batch item deletion' view.
Comment 5 Caroline Cyr La Rose 2024-04-15 14:30:04 UTC
Hi Paul,

I tried to apply the patches, but it gives me an error. 

Should the old patch be obsoleted?

Caroline