Steps to Reproduce:
- Start the import process on the source wiki
- Press return in the edit summary field
Actual Results:
The user is directed to the edit title form.
Expected Results:
The file is imported.
Steps to Reproduce:
Actual Results:
The user is directed to the edit title form.
Expected Results:
The file is imported.
| Subject | Repo | Branch | Lines +/- | |
|---|---|---|---|---|
| Submit the form when hitting return in the summary | mediawiki/extensions/FileImporter | master | +35 -4 |
Thanks for the report. That's indeed a misbehavior. The reason is that browsers consider the first submit button in the form the default one. And we need to make the other two buttons submit buttons as well to make the import process work without JavaScript. There are some workarounds for this behavior: https://stackoverflow.com/questions/925334/how-is-the-default-submit-button-on-an-html-form-determined.
I realized this is technically a regression, caused by the changes done via https://gerrit.wikimedia.org/r/519236 in June. Before, pressing enter probably worked. Unfortunately the patch doesn't explain why the change was made. @Andrew-WMDE, are you able to provide more info?
I think this was related to T230983: Edit summary is blanked when navigating through file importer preview pages. Now I wonder if both problems can be addressed without using JS to do magic in the background ....
The only hacks I can think of at the moment are:
I just looked briefly into this and the other ticket T230983. To summarize the issue here again:
Assuming that we want to avoid data loss for non js users, there's no real alternative to having one form expect the summary in a second step. But that would also work with one form. So lets just say we keep the one form and try to find solutions for that. This solution also makes sure we at least do not lose any data entered by the user.
I could not think of other ideas then the ones mentioned by @thiemowmde above. So lets try to dive into the options.
Use JS to trigger submit when the focus is in the summary field
Arrange the HTML so that the primary submit button comes first (but move it down again with CSS)
Flip the form upside down
Ask for the summary in a second step
I personally slightly prefer the JS only solution but maybe mostly, because it's very easy to implement.
Change 596401 had a related patch set uploaded (by WMDE-Fisch; owner: WMDE-Fisch):
[mediawiki/extensions/FileImporter@master] [WIP] Submit the from when hitting return in the summary
Change 596401 merged by jenkins-bot:
[mediawiki/extensions/FileImporter@master] Submit the form when hitting return in the summary
Decision from today's demo time: Since there is no data loss involved we decided to leave the no-JS workflow as is.