Since the login pane is part for the checkout form, the login, guest checkout and registration options on the login checkout pane are inside the same form. In the default order the three options are:

  1. Login
  2. Guest checkout
  3. Register

If the user fillst the register form and hits enter instead of clicking the submit button, the login submit button is being used as the clicked button and the login fails.

A possible solution would be to bind on hitting enter and select the submit within the same fieldset and trigger a click on it... Not really nice.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Lukas von Blarer created an issue. See original summary.

vasike’s picture

Here is patch this.
It adds a js to login library which should fix the issue.
JS fix : Click the Submit button from the same fieldset of the input on press the enter key.

I really don't know if we could have this in tests.

p.s. could we have other similar cases in checkout?
i'm thinking if we need a more generic checkout js for other panes (multiple submits) cases.

Status: Needs review » Needs work

The last submitted patch, 2: login_pane_submit_on_press_enter-2918221-2.patch, failed testing. View results

Lukas von Blarer’s picture

I'll test this in the coming weeks and provide feedback.

Lukas von Blarer’s picture

I am sorry for my slow feedback... I just tested the patch and it solves this particular problem. But you are totally right, can we somehow fix this issue in a generic way for all checkout forms?

mglaman’s picture

I thought we discovered that core had a library definition for something like this and used it elsewhere

mglaman’s picture

Sorry, I was thinking of drupal.form which prevents duplicate submissions.

3CWebDev’s picture

This patch was not working for me as there were no fieldset elements for the script to find. I don't know if this perhaps changed in a recent update of Commerce but in my installation I had to change the script to find the clossest .panel class. Modified patch is attached.

3CWebDev’s picture

3CWebDev’s picture

flocondetoile’s picture

#8 means that Commerce must add its own class (or data attributes) to have a robust way to find the parent element. And we can not suppose which html element, eventually changed by the front theme, will be the right one. Except those which have our own custom class.

I guess #10 is a fix for a bootstrap based theme.

3CWebDev’s picture

@flocondetoile, good call - yes, I am using the Bootstrap theme. I agree that another, more robust method to target the various potential elements that may exist in the theme.