Bug 27436

Summary: Set focus for cursor to report name field when creating new SQL report
Product: Koha Reporter: Owen Leonard <oleonard>
Component: TemplatesAssignee: Katrin Fischer <katrin.fischer>
Status: CLOSED FIXED QA Contact: Kyle M Hall (khall) <kyle>
Severity: enhancement    
Priority: P5 - low CC: barbara.johnson, gmcharlt, jamespfk, jonathan.druart, kyle, sally.healey, testopia
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:
22.11.00
Circulation function:
Bug Depends on:    
Bug Blocks: 31411    
Attachments: Bug 27436: Set focus for cursor to report name field when creating new SQL report
Bug 27436: Set focus for cursor to report name field when creating new SQL report
Bug 27436: Set focus for cursor to report name field when creating new SQL report
Bug 27436: Set focus on first input when adding a new SQL report
Bug 27436: Set focus on first input when adding a new SQL report
Bug 27436: Set focus on first input when adding a new SQL report

Description Owen Leonard 2021-01-14 16:28:29 UTC
When adding a new SQL report you have to tab to or click the report name field.  It would be more efficient to set the focus automatically by adding a "focus" class to the <input>
Comment 1 James O'Keeffe 2021-01-19 01:32:13 UTC
Created attachment 115275 [details] [review]
Bug 27436: Set focus for cursor to report name field when creating new SQL report

This patch focuses the cursor on the 'Report name' field when creating a
new SQL report

Test plan:
1. Navigate to the 'Create report from SQL' page (Home -> Reports ->
        Guided reports Wizard -> Create from SQL)
2. Observe that the 'Report name' box is not focused on
3. Apply the patch, log in, log out.
4. Repeat step 1. The 'Report name' box should now be focused on.
Comment 2 PTFS Europe Sandboxes 2021-01-19 11:39:48 UTC
Created attachment 115307 [details] [review]
Bug 27436: Set focus for cursor to report name field when creating new SQL report

This patch focuses the cursor on the 'Report name' field when creating a
new SQL report

Test plan:
1. Navigate to the 'Create report from SQL' page (Home -> Reports ->
        Guided reports Wizard -> Create from SQL)
2. Observe that the 'Report name' box is not focused on
3. Apply the patch, log in, log out.
4. Repeat step 1. The 'Report name' box should now be focused on.

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Comment 3 Sally 2021-01-19 11:40:07 UTC
Works as described.
Comment 4 Kyle M Hall (khall) 2021-01-21 16:16:30 UTC
Created attachment 115573 [details] [review]
Bug 27436: Set focus for cursor to report name field when creating new SQL report

This patch focuses the cursor on the 'Report name' field when creating a
new SQL report

Test plan:
1. Navigate to the 'Create report from SQL' page (Home -> Reports ->
        Guided reports Wizard -> Create from SQL)
2. Observe that the 'Report name' box is not focused on
3. Apply the patch, log in, log out.
4. Repeat step 1. The 'Report name' box should now be focused on.

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 5 Kyle M Hall (khall) 2021-01-21 16:17:19 UTC
It might be nice to have the sql textarea focused when editing an existing report, but this is a great improvement!
Comment 6 Jonathan Druart 2021-01-22 13:09:24 UTC
Focus must be put using the "focus" class instead.
Comment 7 Katrin Fischer 2022-08-18 20:09:29 UTC
Created attachment 139419 [details] [review]
Bug 27436: Set focus on first input when adding a new SQL report

When adding a new SQL report, the focus/cursor should be
in the first input field of the form: Report name

To test:
* Add a new SQL report in reports > new from SQL
  - cursur is in no field
* Apply patch
* Add another new SQL report
  - cursor is now in the first input field of the form: Report name
Comment 8 Katrin Fischer 2022-08-18 20:13:06 UTC
I implemented the standard solution for setting the focus using the CSS class as suggested in comment#6. As both patches were one line fixes mine replaces James' previous patch. I didn't see a better way, if you prefer this as a follow-up, please let me know.

I didn't change the behavior for editing an existing patch as I think while SQL might be the most 'common' field to change, it could also be a danger of making unwanted changes and I found other examples where on editing the focus is on top.
Comment 9 ByWater Sandboxes 2022-08-18 20:46:04 UTC
Created attachment 139427 [details] [review]
Bug 27436: Set focus on first input when adding a new SQL report

When adding a new SQL report, the focus/cursor should be
in the first input field of the form: Report name

To test:
* Add a new SQL report in reports > new from SQL
  - cursur is in no field
* Apply patch
* Add another new SQL report
  - cursor is now in the first input field of the form: Report name

Signed-off-by: Barbara Johnson <barbara.johnson@bedfordtx.gov>
Comment 10 Kyle M Hall (khall) 2022-09-02 14:37:26 UTC
Created attachment 140157 [details] [review]
Bug 27436: Set focus on first input when adding a new SQL report

When adding a new SQL report, the focus/cursor should be
in the first input field of the form: Report name

To test:
* Add a new SQL report in reports > new from SQL
  - cursur is in no field
* Apply patch
* Add another new SQL report
  - cursor is now in the first input field of the form: Report name

Signed-off-by: Barbara Johnson <barbara.johnson@bedfordtx.gov>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 11 Tomás Cohen Arazi (tcohen) 2022-09-07 20:46:10 UTC
Pushed to master for 22.11.

Nice work everyone, thanks!