Bug 25349 - Enter in the username field submits the login, instead of moving focus to the password field
Summary: Enter in the username field submits the login, instead of moving focus to the...
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Self checkout (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal (vote)
Assignee: Lucas Gass
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-05-01 17:40 UTC by Donna
Modified: 2021-12-13 21:09 UTC (History)
4 users (show)

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


Attachments
Bug 25349: Add checkEnter function and apply it to SCO page (4.25 KB, patch)
2020-05-05 18:09 UTC, Lucas Gass
Details | Diff | Splinter Review
Bug 25349: Add checkEnter function and apply it to SCO page (4.30 KB, patch)
2020-05-31 20:04 UTC, Victor Grousset/tuxayo
Details | Diff | Splinter Review
Bug 25349: Add checkEnter function and apply it to SCO page (4.24 KB, patch)
2020-06-03 18:36 UTC, Lucas Gass
Details | Diff | Splinter Review
Bug 25349: Add checkEnter function and apply it to SCO page (3.49 KB, patch)
2020-06-04 14:20 UTC, Lucas Gass
Details | Diff | Splinter Review
Bug 25349: Add checkEnter function and apply it to SCO page (3.54 KB, patch)
2020-06-04 14:32 UTC, ByWater Sandboxes
Details | Diff | Splinter Review
Bug 25349: Add checkEnter function and apply it to SCO page (3.60 KB, patch)
2020-06-14 11:56 UTC, Katrin Fischer
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Donna 2020-05-01 17:40:29 UTC
When using self checkout set to login with username and password and an "enter" function is submitted in the username field, the form is submitted instead of moving the focus to the password field.

For libraries that have patrons scan their barcode for the username, this causes a never ending loop of not being able to login.  The "enter" function is necessary from the barcode scanner when checking out books etc, so that can't be changed.  The desired behavior would be to move the focus to next field on the form so patrons can scan their barcode, then type in the password, and then the enter key would submit the form.

To recreate:
1.  Enable self checkout function
2.  Set sys pref SelfCheckoutByLogin to Username and Password
3.  Go to your self check site and log in as your self check user
4.  In the username field, type in a username and hit the enter key, or using a barcode scanner, scan a barcode.
5.  Notice that the form is submitted, and results in a failed login, returning the patron to a blank log in screen.

The same behavior is in 18.11, 19.05, and 19.11.
Comment 1 Lucas Gass 2020-05-01 20:59:50 UTC
I think submitting a form by pressing Enter is a default behavior for form submission and I will be interested to hear what others say about this. In the meantime this javascript in the SCOUserJS system preference can alleviate the problem: (at least for US keyboards)

document.getElementById("patronlogin").onkeypress = function(e) {
  var key = e.charCode || e.keyCode || 0;     
  if (key == 13) {
     document.getElementById("patronpw").focus();
     return false;
  }
}
Comment 2 Owen Leonard 2020-05-01 21:27:51 UTC
The staff client has a globally-available checkEnter function which we use in multiple places. The same could easily be added to the OPAC.
Comment 3 Lucas Gass 2020-05-05 18:09:13 UTC
Created attachment 104378 [details] [review]
Bug 25349: Add checkEnter function and apply it to SCO page

This patch adds the checkEnter function to the OPAC global.js and then applies it to the SCO login page.
TO TEST:
1. Go to SCO login and try entering something in the "Login:" input amd "Password:" input.
2. Pressing enter while in either will automatically submit the form.
3. Apply patch.
4. Repeat step 1-2.
5. This time the form should not submit itself when you press Enter.
Comment 4 Victor Grousset/tuxayo 2020-05-31 20:04:38 UTC
Created attachment 105446 [details] [review]
Bug 25349: Add checkEnter function and apply it to SCO page

This patch adds the checkEnter function to the OPAC global.js and then applies it to the SCO login page.
TO TEST:
1. Go to SCO login and try entering something in the "Login:" input amd "Password:" input.
2. Pressing enter while in either will automatically submit the form.
3. Apply patch.
4. Repeat step 1-2.
5. This time the form should not submit itself when you press Enter.

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Comment 5 Victor Grousset/tuxayo 2020-05-31 20:06:18 UTC
It works! :D

However, is there a reason for the password field to not submit the form when hitting enter?
Comment 6 Victor Grousset/tuxayo 2020-05-31 20:13:07 UTC
Wait, title says that hitting enter in the login field should move focus to the password field.

But the patch only mentions not sending the form.

So what are the current specs? For the above point and the above comment.
Comment 7 Lucas Gass 2020-06-01 14:55:27 UTC
Good point Victor,

Currently it will not submit the form by pressing enter in either of the fields. But maybe it would be better workflow if it DID submit the form when pressing enter in the 2nd field (password)?
Comment 8 Donna 2020-06-01 20:18:56 UTC
(In reply to Lucas Gass from comment #7)
> Good point Victor,
> 
> Currently it will not submit the form by pressing enter in either of the
> fields. But maybe it would be better workflow if it DID submit the form when
> pressing enter in the 2nd field (password)?

This would be the ideal behavior.
Comment 9 Lucas Gass 2020-06-01 20:37:30 UTC
Failing qa here and will submit a new patch ASAP
Comment 10 Lucas Gass 2020-06-03 18:36:51 UTC
Created attachment 105533 [details] [review]
Bug 25349: Add checkEnter function and apply it to SCO page

This patch adds the checkEnter function to the OPAC global.js and then applies it to the SCO login page.
TO TEST:
1. Go to SCO login and try entering something in the "Login:" input amd "Password:" input.
2. Pressing enter while in either will automatically submit the form.
3. Apply patch.
4. Type something into the Login: field and press enter, the form should NOT submit.
5. Type something into the Password: field and pess enter, this SHOULD submit the form.
6. Change the syspref SelfCheckoutByLogin to 'Cardnumber'
7. TType something into the Please enter your card number: field, the form should NOT submit.
Comment 11 Lucas Gass 2020-06-03 18:38:37 UTC
I changed how this patch functions so I am reseting to Needs Sign-off, I also removed Victor's sign-off line.
Comment 12 Lucas Gass 2020-06-04 14:20:57 UTC
Created attachment 105556 [details] [review]
Bug 25349: Add checkEnter function and apply it to SCO page

This patch adds the checkEnter function to the OPAC global.js and then applies it to the SCO login page.
TO TEST:
1. Go to SCO login and try entering something in the "Login:" input amd "Password:" input.
2. Pressing enter while in either will automatically submit the form.
3. Apply patch.
4. Type something into the Login: field and press enter, the form should NOT submit.
5. Type something into the Password: field and pess enter, this SHOULD submit the form.
6. Change the syspref SelfCheckoutByLogin to 'Cardnumber'
7. Type something into the Please enter your card number: field, the form should submit.
Comment 13 ByWater Sandboxes 2020-06-04 14:32:45 UTC
Created attachment 105557 [details] [review]
Bug 25349: Add checkEnter function and apply it to SCO page

This patch adds the checkEnter function to the OPAC global.js and then applies it to the SCO login page.
TO TEST:
1. Go to SCO login and try entering something in the "Login:" input amd "Password:" input.
2. Pressing enter while in either will automatically submit the form.
3. Apply patch.
4. Type something into the Login: field and press enter, the form should NOT submit.
5. Type something into the Password: field and pess enter, this SHOULD submit the form.
6. Change the syspref SelfCheckoutByLogin to 'Cardnumber'
7. Type something into the Please enter your card number: field, the form should submit.

Signed-off-by: Donnab <donna@bywatersolutions.com>
Comment 14 Katrin Fischer 2020-06-14 11:56:35 UTC
Created attachment 105858 [details] [review]
Bug 25349: Add checkEnter function and apply it to SCO page

This patch adds the checkEnter function to the OPAC global.js and then applies it to the SCO login page.
TO TEST:
1. Go to SCO login and try entering something in the "Login:" input amd "Password:" input.
2. Pressing enter while in either will automatically submit the form.
3. Apply patch.
4. Type something into the Login: field and press enter, the form should NOT submit.
5. Type something into the Password: field and pess enter, this SHOULD submit the form.
6. Change the syspref SelfCheckoutByLogin to 'Cardnumber'
7. Type something into the Please enter your card number: field, the form should submit.

Signed-off-by: Donnab <donna@bywatersolutions.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 15 Jonathan Druart 2020-06-15 09:59:40 UTC
Pushed to master for 20.11, thanks to everybody involved!
Comment 16 Lucas Gass 2020-06-17 22:27:54 UTC
backported to 20.05.x for 20.05.01
Comment 17 Aleisha Amohia 2020-06-19 03:57:50 UTC
this doesn't appear to fix the bug on 19.11.x, the form still submits when pressing enter in the username box. not backported