Bug 17566 - Change initial focus in item editor depending on last action
Summary: Change initial focus in item editor depending on last action
Status: CLOSED WONTFIX
Alias: None
Product: Koha
Classification: Unclassified
Component: Cataloging (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Marcel de Rooy
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-11-07 13:13 UTC by Marcel de Rooy
Modified: 2017-02-20 08:29 UTC (History)
2 users (show)

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


Attachments
Bug 17566: Change initial focus in item editor depending on last action (3.00 KB, patch)
2016-11-07 13:34 UTC, Marcel de Rooy
Details | Diff | Splinter Review
Bug 17566: Change initial focus in item editor depending on last action (3.01 KB, patch)
2016-11-07 14:17 UTC, Marcel de Rooy
Details | Diff | Splinter Review
[SIGNED-OFF] Bug 17566: Change initial focus in item editor depending on last action (3.03 KB, patch)
2016-11-07 20:41 UTC, Josef Moravec
Details | Diff | Splinter Review
Bug 17566: [Follow-up] Initial focus on first select or input (2.01 KB, patch)
2016-12-02 07:22 UTC, Marcel de Rooy
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Marcel de Rooy 2016-11-07 13:13:22 UTC
If you have saved an existing item or added a new one, it would be nice to have the focus in the search box.
In other cases, at the start of adding or editing an item, it would be good to have focus in the item fields already.
This patch sets the focus in the second case on the first item input field, since focus on the first select (combo box) does not show up.
Comment 1 Marcel de Rooy 2016-11-07 13:34:51 UTC
Created attachment 57257 [details] [review]
Bug 17566: Change initial focus in item editor depending on last action

If you have saved an existing item or added a new one, it would be nice to
have the focus in the search box. In other cases, at the start of adding or
editing an item, it would be good to have focus in the item fields already.

This patch sets the focus in the second case on the first item input field,
since focus on the first select (combo box) does not show up.

Test plan:
[1] From staff detail view, click Edit items in the menu. Focus should go
    to item fields.
[2] Save this new item. Focus on search box?
[3] Click to edit this item. Focus on item fields?
[4] Save again. Focus on search box again?
[5] Delete this item. Focus on search box again?
Comment 2 Marcel de Rooy 2016-11-07 14:17:21 UTC
Created attachment 57259 [details] [review]
Bug 17566: Change initial focus in item editor depending on last action

If you have saved an existing item or added a new one, it would be nice to
have the focus in the search box. In other cases, at the start of adding or
editing an item, it would be good to have focus in the item fields already.

This patch sets the focus in the second case on the first item input field,
since focus on the first select (combo box) does not show up.

Test plan:
[1] From staff detail view, click Edit items in the menu. Focus should go
    to item fields.
[2] Save this new item. Focus on search box?
[3] Click to edit this item. Focus on item fields?
[4] Save again. Focus on search box again?
[5] Delete this item. Focus on search box again?
Comment 3 Josef Moravec 2016-11-07 20:41:50 UTC
Created attachment 57281 [details] [review]
[SIGNED-OFF] Bug 17566: Change initial focus in item editor depending on last action

If you have saved an existing item or added a new one, it would be nice to
have the focus in the search box. In other cases, at the start of adding or
editing an item, it would be good to have focus in the item fields already.

This patch sets the focus in the second case on the first item input field,
since focus on the first select (combo box) does not show up.

Test plan:
[1] From staff detail view, click Edit items in the menu. Focus should go
    to item fields.
[2] Save this new item. Focus on search box?
[3] Click to edit this item. Focus on item fields?
[4] Save again. Focus on search box again?
[5] Delete this item. Focus on search box again?

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Comment 4 Jonathan Druart 2016-11-23 09:48:08 UTC
I don't really like that, especially because it does not work with select. It's weird to select the 4th element (in my case) of the add item form.
I'd like to get cataloguer specialist point of views.
Comment 5 Marcel de Rooy 2016-12-02 07:22:15 UTC
Created attachment 57881 [details] [review]
Bug 17566: [Follow-up] Initial focus on first select or input

Previous patch just set the focus to the first input, because the focus
on the first select does not show up in some browsers (incl FF). Joubu
complained about that, which is not unreasonable :)

This patch puts the focus on the first subfield (under conditions described
earlier). We do not solve all browser problems here, but it still is an
improvement compared to the original focus.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 6 Marcel de Rooy 2016-12-02 07:23:41 UTC
(In reply to Jonathan Druart from comment #4)
> I don't really like that, especially because it does not work with select.
> It's weird to select the 4th element (in my case) of the add item form.
> I'd like to get cataloguer specialist point of views.

Your concern should be dealt with in the second patch, although focus and various browsers are not my favorite topic ;)
Comment 7 Jonathan Druart 2016-12-13 14:46:26 UTC
With the second patch, I don't see the focus at all.
It seems to be on the first select because when I tab it selects the second select. But I cannot interact with it (select an option).
Comment 8 Marcel de Rooy 2016-12-13 14:58:52 UTC
(In reply to Jonathan Druart from comment #7)
> With the second patch, I don't see the focus at all.
> It seems to be on the first select because when I tab it selects the second
> select. But I cannot interact with it (select an option).

Thats a browser problem that I cannot solve.
The focus is there.
See commit message.
Comment 9 Marcel de Rooy 2017-02-17 12:22:47 UTC
Changing status to BLOCKED
Anyone have a clue how to make this focus visible?
Comment 10 Owen Leonard 2017-02-17 13:33:33 UTC
If we want to put the focus on the first select2-styled <select> I think we have to trigger it to open:

https://select2.github.io/examples.html#programmatic

However, I wonder whether this bug makes too many assumptions about how catalogers want to work. In our framework the first subfield is "Withdrawn status," and that's almost never the first field the catalogers will want to change.

The focus returns to the search form at the top after I have edited an item, but what if I wanted to edit another item next?

I worry that this patch assumes a workflow which is not universal enough to make it appropriate.
Comment 11 Marcel de Rooy 2017-02-20 08:28:46 UTC
(In reply to Owen Leonard from comment #10)
> If we want to put the focus on the first select2-styled <select> I think we
> have to trigger it to open:
> 
> https://select2.github.io/examples.html#programmatic

Thanks for your feedback. Could not get it working rightaway..
Maybe for this reason:
http://stackoverflow.com/questions/2562723/javascript-focus-and-select-not-working-in-ff
Not spending too much time on it now.

> However, I wonder whether this bug makes too many assumptions about how
> catalogers want to work. In our framework the first subfield is "Withdrawn
> status," and that's almost never the first field the catalogers will want to
> change.
> 
> The focus returns to the search form at the top after I have edited an item,
> but what if I wanted to edit another item next?
> 
> I worry that this patch assumes a workflow which is not universal enough to
> make it appropriate.

Yeah. You made a QAer happy :)
But I must of course admit that this patch is in the 'foggy' category.