Bug 27192

Summary: Set focus for cursor to item type input box when creating new item types
Product: Koha Reporter: Barbara Johnson <barbara.johnson>
Component: TemplatesAssignee: Andreas Roussos <a.roussos>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: a.roussos, aleisha, andrewfh, caroline.cyr-la-rose, fridolin.somers, gmcharlt, jonathan.druart, victor
Version: MainKeywords: Academy
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:
21.05.00,20.11.03,20.05.09,19.11.15
Attachments: Bug 27192: Automatically set focus to the item type input box
Bug 27192: Automatically set focus to the item type input box
Bug 27192: Automatically set focus to the item type input box
Bug 27192: Automatically set focus to the item type input box
Bug 27192: Automatically set focus to the item type input box

Description Barbara Johnson 2020-12-10 16:09:33 UTC
When adding a new item type on itemtypes.pl you have to click in the item type input box, which is a required field, so that you can enter text.  It would be more efficient to set the focus for the cursor to always be in the item type input box so that you could just begin typing and eliminate an extra click.
Comment 1 Andreas Roussos 2021-01-08 15:14:44 UTC
Created attachment 114968 [details] [review]
Bug 27192: Automatically set focus to the item type input box

When adding a new item type, you have to click inside the
"Ιtem type:" input box before you can start entering text.

This patch fixes that by adding the "focus" class to the relevant
<input> element so that cursor focus is set when the page loads.

Test plan:

1) Try to add a new item type: notice how you have to manually
   click inside the "Item type:" input box before you start typing.
2) Apply this patch.
3) Repeat step 1) -- this time the "Item type:" input box should
   gain focus automatically.
Comment 2 Andreas Roussos 2021-01-08 15:18:43 UTC
I based my patch on Owen Leonard's work in Bug 26694 -- Thank you Owen!
Comment 3 Kelly McElligott 2021-01-13 00:37:57 UTC
Created attachment 115105 [details] [review]
Bug 27192: Automatically set focus to the item type input box

When adding a new item type, you have to click inside the
"Ιtem type:" input box before you can start entering text.

This patch fixes that by adding the "focus" class to the relevant
<input> element so that cursor focus is set when the page loads.

Test plan:

1) Try to add a new item type: notice how you have to manually
   click inside the "Item type:" input box before you start typing.
2) Apply this patch.
3) Repeat step 1) -- this time the "Item type:" input box should
   gain focus automatically.

Signed-off-by: Kelly McElligott <kelly@bywatersolutions.com>
Comment 4 Katrin Fischer 2021-01-17 16:10:23 UTC
Created attachment 115225 [details] [review]
Bug 27192: Automatically set focus to the item type input box

When adding a new item type, you have to click inside the
"Ιtem type:" input box before you can start entering text.

This patch fixes that by adding the "focus" class to the relevant
<input> element so that cursor focus is set when the page loads.

Test plan:

1) Try to add a new item type: notice how you have to manually
   click inside the "Item type:" input box before you start typing.
2) Apply this patch.
3) Repeat step 1) -- this time the "Item type:" input box should
   gain focus automatically.

Signed-off-by: Kelly McElligott <kelly@bywatersolutions.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 5 Amy King 2021-01-18 22:45:30 UTC
Created attachment 115254 [details] [review]
Bug 27192: Automatically set focus to the item type input box

When adding a new item type, you have to click inside the
"Ιtem type:" input box before you can start entering text.

This patch fixes that by adding the "focus" class to the relevant
<input> element so that cursor focus is set when the page loads.

Test plan:

1) Try to add a new item type: notice how you have to manually
   click inside the "Item type:" input box before you start typing.
2) Apply this patch.
3) Repeat step 1) -- this time the "Item type:" input box should
   gain focus automatically.

Signed-off-by: Kelly McElligott <kelly@bywatersolutions.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Amy King <amyking386@gmail.com>
Comment 6 Katrin Fischer 2021-01-18 23:12:02 UTC
Created attachment 115256 [details] [review]
Bug 27192: Automatically set focus to the item type input box

When adding a new item type, you have to click inside the
"Ιtem type:" input box before you can start entering text.

This patch fixes that by adding the "focus" class to the relevant
<input> element so that cursor focus is set when the page loads.

Test plan:

1) Try to add a new item type: notice how you have to manually
   click inside the "Item type:" input box before you start typing.
2) Apply this patch.
3) Repeat step 1) -- this time the "Item type:" input box should
   gain focus automatically.

Signed-off-by: Kelly McElligott <kelly@bywatersolutions.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 7 Katrin Fischer 2021-01-18 23:12:16 UTC
Thx Amy :)
Comment 8 Jonathan Druart 2021-01-20 08:46:08 UTC
Shouldn't it be implemented for the "edit" action as well?
Focus would be on "Parent item type".
Comment 9 Jonathan Druart 2021-01-20 15:25:49 UTC
Owen answered me on IRC:

 oleonard> The suggestion is logical, but from the point of view of a sighted user, focus on a <select> is much less obvious. There is also the question of whether the user really wants to edit all fields starting from the beginning, or whether they're looking for a particular field to change.
 oleonard> My inclination is to leave it as it is for the edit action.
Comment 10 Jonathan Druart 2021-01-21 13:40:18 UTC
Pushed to master for 21.05, thanks to everybody involved!
Comment 11 Fridolin Somers 2021-01-25 15:24:35 UTC
Super small enhancement, I choose to backport.

Pushed to 20.11.x for 20.11.03
Comment 12 Andrew Fuerste-Henry 2021-02-01 20:42:56 UTC
Following Frido, backporting to 20.05.x for 20.05.09
Comment 13 Victor Grousset/tuxayo 2021-02-02 01:04:18 UTC
Backported: Pushed to 19.11.x branch for 19.11.15