Bug 30640 - Focus does not always move to correct search header form field
Summary: Focus does not always move to correct search header form field
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Templates (show other bugs)
Version: master
Hardware: All All
: P5 - low minor (vote)
Assignee: Owen Leonard
QA Contact: Testopia
URL:
Keywords:
Depends on: 29155
Blocks:
  Show dependency treegraph
 
Reported: 2022-04-28 11:55 UTC by Owen Leonard
Modified: 2023-06-08 22:28 UTC (History)
2 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
22.05.00


Attachments
Bug 30640: Focus does not always move to correct search header form field (5.56 KB, patch)
2022-04-28 12:11 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 30640: Focus does not always move to correct search header form field (5.71 KB, patch)
2022-05-18 08:24 UTC, Séverine Queune
Details | Diff | Splinter Review
Bug 30640: Focus does not always move to correct search header form field (5.79 KB, patch)
2022-05-18 09:19 UTC, Jonathan Druart
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Owen Leonard 2022-04-28 11:55:57 UTC
The jQuery upgrade has introduced a bug with how the header search form is supposed to handle focus. This can be seen in any page where the "Check out" tab is present in the header search but not the pre-selected tab, e.g. the patron detail tab.

On the patron details page the "Search patrons" tab is selected by default, and the cursor focus is automatically put on the form field. Switch to the "Check out" tab and you'll find that the focus doesn't move to the form field. The other tabs don't have this problem.

I think this is the explanation: https://github.com/jquery/jquery/issues/4950

To fix we'll need to remove the "focus" class on form fields which might be hidden by default and update the tabs behavior to make sure the right field is focused on load.
Comment 1 Owen Leonard 2022-04-28 12:11:25 UTC
Created attachment 134224 [details] [review]
Bug 30640: Focus does not always move to correct search header form field

This patch updates the staff interface's global JavaScript to
accommodate changes in the way focus is being handled after the jQuery
upgrade (see: https://github.com/jquery/jquery/issues/4950).

The "focus" class is removed from search header include files so that
there isn't a contradiction between which form field has the focus class
and which form field is displayed in the active tab.

To test, apply the patch and view various pages in the staff interface.

- On pages where focus is not being directed to a form field within the
  main content of the page, the form field in the active search header
  tab should have focus on page load:

  - Patron details
  - System preferences
  - Cities and towns

  Also test pages where a tab other than the first one is preselected:

  - Bibliographic details page
  - Patron lists

  On these pages, focus should move to the active tab's form field when
  you switch tabs.

- On pages where focus is being sent to another form field, it should
  work correctly:

  - Patrons home page
  - Check in
  - Acquisitions home page
Comment 2 Séverine Queune 2022-05-18 08:24:47 UTC
Created attachment 135093 [details] [review]
Bug 30640: Focus does not always move to correct search header form field

This patch updates the staff interface's global JavaScript to
accommodate changes in the way focus is being handled after the jQuery
upgrade (see: https://github.com/jquery/jquery/issues/4950).

The "focus" class is removed from search header include files so that
there isn't a contradiction between which form field has the focus class
and which form field is displayed in the active tab.

To test, apply the patch and view various pages in the staff interface.

- On pages where focus is not being directed to a form field within the
  main content of the page, the form field in the active search header
  tab should have focus on page load:

  - Patron details
  - System preferences
  - Cities and towns

  Also test pages where a tab other than the first one is preselected:

  - Bibliographic details page
  - Patron lists

  On these pages, focus should move to the active tab's form field when
  you switch tabs.

- On pages where focus is being sent to another form field, it should
  work correctly:

  - Patrons home page
  - Check in
  - Acquisitions home page

Signed-off-by: Séverine Queune <severine.queune@bulac.fr>
Comment 3 Séverine Queune 2022-05-18 08:28:53 UTC
Thanks Owen, it works fine !
Comment 4 Jonathan Druart 2022-05-18 09:19:49 UTC
Created attachment 135095 [details] [review]
Bug 30640: Focus does not always move to correct search header form field

This patch updates the staff interface's global JavaScript to
accommodate changes in the way focus is being handled after the jQuery
upgrade (see: https://github.com/jquery/jquery/issues/4950).

The "focus" class is removed from search header include files so that
there isn't a contradiction between which form field has the focus class
and which form field is displayed in the active tab.

To test, apply the patch and view various pages in the staff interface.

- On pages where focus is not being directed to a form field within the
  main content of the page, the form field in the active search header
  tab should have focus on page load:

  - Patron details
  - System preferences
  - Cities and towns

  Also test pages where a tab other than the first one is preselected:

  - Bibliographic details page
  - Patron lists

  On these pages, focus should move to the active tab's form field when
  you switch tabs.

- On pages where focus is being sent to another form field, it should
  work correctly:

  - Patrons home page
  - Check in
  - Acquisitions home page

Signed-off-by: Séverine Queune <severine.queune@bulac.fr>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 5 Fridolin Somers 2022-05-19 03:22:57 UTC
Pushed to master for 22.05, thanks to everybody involved 🦄