Not possible to submit forms with pressing ENTER, if form has a file field

Created on 5 May 2015, over 9 years ago
Updated 28 February 2023, almost 2 years ago

Problem/Motivation

When filling out the register new user form, it should be possible to press enter to submit the form. Right now, this is not possible, if the form includes the "user picture" field (which it does by default in the standard profile). With javascript enabled, simply nothing happens.

This also has the added side effect that if you press enter without javascript enabled, the form gets submitted, but you don't get any error messages.

If i disable the user picture field, the form can be submitted with the enter key both with and without javascript enabled.

Some gifs attached to illustrate.

I looked quickly through the javascript, and it seems that because the element of the picture has the property element_settings.prevent set to click, it disables click, and everything stops working.

The preventing of click happens in ajax.js line 287.

Just tested. This applies to a node form with either file or image field attached also.

Proposed resolution

Not sure yet

Remaining tasks

Fix it :)

User interface changes

Not sure yet.

API changes

Hopefully none?

πŸ› Bug report
Status

Active

Version

8.0 ⚰️

Component
AjaxΒ  β†’

Last updated 1 day ago

Created by

πŸ‡³πŸ‡΄Norway eiriksm Norway

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡¬πŸ‡§United Kingdom alexpott πŸ‡ͺπŸ‡ΊπŸŒ

    This issue has an "interesting" effect.

    Do the following:

    • Install standard
    • Login in as a user that can create content
    • Visit node/add/page - enter text in the title field and press enter to finish entering the it - the node will save and you'll end up on node/1
    • Visit node/add/article - enter text in the title field and press enter to finish entering the it - the node will not save and nothing will happen.

    I'm really really not sure what the correct solution is here or whether we want a solution but the behaviour is odd and very hard to explain to a user.

Production build 0.71.5 2024