Created attachment 25914 [details] search box edit item Hi, In 3.12 (or 3.10), a catalog search box has been added to edit item page. When i click on edit, cursor is positioning in search box and not to the item i want to edit. If i have 100 items, i have to scroll to the end of the page. Anyone can test it? Regards, Marjorie
I am seeing the same thing in 3.12 and 3.14. I think the script on the page is the issue, setting the focus in search and overriding the anchor, with JS disabled the page loads as expected. This bit seems to be it: <script>$(document).ready(function(){ $("input[name=q]:eq(0)").focus(); });</script>
(In reply to Nick Clemens from comment #1) > I am seeing the same thing in 3.12 and 3.14. > > I think the script on the page is the issue, setting the focus in search and > overriding the anchor, with JS disabled the page loads as expected. > > This bit seems to be it: > > <script>$(document).ready(function(){ > $("input[name=q]:eq(0)").focus(); > });</script> Thanks Nick for explanation. Do you know a script js to remove focus? Marjorie
(In reply to Marjorie Barry-Vila from comment #2) > (In reply to Nick Clemens from comment #1) > > Thanks Nick for explanation. > Do you know a script js to remove focus? > > Marjorie From what I see the intranetusersjs loads before the script on the page, so you have to execute on window load to be able to steal focus. Below should work $(window).load(function (){ $('[id^="tag_952_subfield_0_"]').focus(); }); I think the bigger issue though is that cataloging-search.inc is set to take focus on every page where present. The link created when you click to edit an item has an anchor at the end and I am guessing the intention was, at one point, to set the focus to the edititem id once an item was being edited. I do think that is the more useful fonctionality Bug 11325 seems to be centered around the same issue with focus on the search box.
Created attachment 28166 [details] [review] Patch to remove js from cataloging-search
more description: Currently the cataloging-search.inc has js that takes focus on any page it is added to. I think that focus should be in the individual templates for each page rather than in the search for all. Above patch attempts to resolve this issue by removing the focus js from cataloging-search.inc
Patch tested with a sandbox, by Christopher Brannon <cbrannon@cdalibrary.org>
Created attachment 28666 [details] [review] Bug 11905 - when editing item, cursor is positioning in search box and not to item The cataloging-search.inc had js which set focus to the cataloging search box. I believe the focus should be determined by the page template and not always to this search. I simply removed the js. Signed-off-by: Christopher Brannon <cbrannon@cdalibrary.org>
Created attachment 28668 [details] [review] [SIGNED-OFF] Bug 11905 - when editing item, cursor is positioning in search box and not to item The cataloging-search.inc had js which set focus to the cataloging search box. I believe the focus should be determined by the page template and not always to this search. I simply removed the js. Signed-off-by: Juhani Seppälä <jseppal@student.uef.fi>
The include file cataloging-search.inc is used in 3 templates. I am not sure this is the good way to do. Maybe should you move the js code from the include file to the 2 other tt files (not sure it is useful for merge.tt). Marked as Failed QA.
Agreed, I thought about adding to the others when I removed it, it doesn't hurt on merge.tt as there is no other place for focus so adding the js into both.
Created attachment 28717 [details] [review] Patch to remove js from cataloging-search and add to individual tt files This patch removes js that sets focus to the cataloging search from the cataloging-search.inc to allow focus on additems.pl to be set to the add items form. The js is added into merge.tt and addbooks.tt to keep focus on the cataloging search there. Test plan: 1. Apply patch 2. Go to the edit items screen for any record and verify that focus is not set to the cataloging search 3. Add two items to a list and merge them, verify focus is set to cataloging search box 4. Go to Cataloging and verify that focus is set to cataloging search box
I've applied against master 3.17.00.007 Everything's OK. So I pass the patch to "Signed Off" status.
Created attachment 28837 [details] [review] Bug 11905 Patch to remove js from cataloging-search and add to individual tt files
Created attachment 28839 [details] [review] Bug 11905 - when editing item, cursor is positioning in search box and not to item cataloging-search.inc had embedded js to set focus into the search box. This patch removes that js from the cataloging-search.inc and adds it into addbooks.tt and merge.tt to set focus on those pages and allow focus to be set to the edit items form on additem.tt Signed-off-by: Paola Rossi <paola.rossi@cineca.it> Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Patch pushed to master. Thanks Nick!