numero2 / contao-deepl

DeepL powered translations in the Contao Backend.
GNU Lesser General Public License v3.0
5 stars 0 forks source link

Enter key does not submit the edit form #2

Closed aschempp closed 2 months ago

aschempp commented 2 months ago

If I press the enter key on a text field, it appears to submit the data to deepl instead of submitting the edit record in the back end. Is this intentional? It really confused me because I usually press enter if I just change a little text field 😅

bennyborn commented 2 months ago

Wow, nice feature but unfortunately not intentional 😁 Trying to figure out whats going on...

bennyborn commented 2 months ago

So according to MDN every button without a type set explicitly will be handled like type="submit".

If your buttons are not for submitting form data to a server, be sure to set their type attribute to button. Otherwise, they will try to submit form data and to load the (nonexistent) response, possibly destroying the current state of the document.

So as soon as you press enter on the input the browser will search for the first submit button to submit the form an that's where our translation handling come into play.

Will release a fixed version right now.

Thanks @aschempp

aschempp commented 2 months ago

I guess type="button" would solve the issue then?

bennyborn commented 2 months ago

It did, yes 😊