Closed ZTrotter closed 7 months ago
It seems for me that your code is not working correctly. Tested on AgentTicketNote with disabled Frontend::RichText
.
Event.preventDefault();
: I've entered some text into the textarea and then I've typed a text into the input field and pressed Enter. The "Save as draft"-popup is opened and a second later the form get submitted and the article is saved.@ZTrotter
Unfortunately we had to revert this PR because it had the side effect of forms without clickable submit buttons not being submittable anymore via Enter key. This is the case e.g. in AdminSystemConfiguration when using the search box and pressing Enter to show all matching results or in AdminCustomerUser searching for a user and pressing Enter.
If you have a solution for this side effect, we're happy to include it.
Thank you.
@jepf @NiklasSchmitt
I have now created a solution to the above side-effect and would like to update the PR with the latest commit, but as the PR has been merged already, I'm not able to do so. Should I create a new PR for this fix or is there an alternative option?
@ZTrotter
👍 It would be best to create a new PR.
Thank you!
Perfect, I'll do that.
Thanks!
Proposed change
On a page with both Save as new draft and Submit buttons, clicking the Enter key inside a
<input>
box triggers the Save as new draft button by default. This behaviour is not consistent with the same pages in Znuny6.In order to fix this behaviour, the following code could be added to Core.Form.js to handle this situation.
Additionally, the code that handles the user attempting to submit a form from within a
<textarea>
whenFrontend::RichText
is disabled could be updated to similarly trigger the expected button by changing the logic of how the button is selected. Currently it selects the first element with the type submit, which it mistakenly believes to be save as new draft, changing this tolast()
instead will trigger the expected button.Type of change
'1 - 🐞 bug 🐞'
Additional information
Replication
AgentTicketZoom
Checklist