User tests: Successful: Unsuccessful:
Pull Request for Issue #37106 (or, at least, an issue having the exact same symptoms and behaviour).
Modify the element used for button data selector when using any button of the com_content edit form on the front-end.
Modify an existing article using the front-end. Save by clicking specifically on the checkbox icon in the save button (so that the event.target
is the span.icon-check
).
The article is not saved, as the POST request sent to the server has an empty task
field.
The article is correctly saved.
Please select:
Documentation link for docs.joomla.org:
No documentation changes for docs.joomla.org needed
Pull Request link for manual.joomla.org:
No documentation changes for manual.joomla.org needed
Status | New | ⇒ | Pending |
Category | ⇒ | JavaScript Repository NPM Change |
Title |
|
Of course. That's done!
Save by clicking specifically on the checkbox icon in the save button (so that the
event.target
is thespan.icon-check
).
Can you provide a screenshot where to click or explain in another way?
Of course. JavaScript set in event.target
the element that is clicked, which may be a child of the element containing the handler (detailed explanation here: https://fr.javascript.info/bubbling-and-capturing). In my case, the save buttons are like this:
Which translate in the HTML syntax to (for a single button):
<button type="button" class="btn btn-primary" data-submit-task="article.apply">
<span class="icon-check" aria-hidden="true"></span>
Enregistrer
</button>
Therefore, clicking on the "check" icon (corresponding to the span
tag) triggers the save event with the span
as event.target
, which is used to determine the task using the data-submit-task
property. As the span
does not have it (only the button
does), an empty string is transmitted in the POST request in the task
variable and the bug occurs.
Thanks but can you provide a screenshot where to click to get the bug?
I have tested this item ✅ successfully on 8e6ae5c
Test by using default 5.2.2 + prebuilt update package.
@NicolasDerumigny I haven't noticed its about the frontend. Can you update the test instructions like "Modify an existing article in the frontend."?
Title |
|
That's done! Let me know if you need anything else!
Note, you can also use e.currentTarget
I have tested this item ✅ successfully on 8e6ae5c
Before patch: Click on the icon itself: article is not saved. No warning no error.
After Patch: Article is saved with "success" message, as expected.
Can the PR get synced with the base branch and set as "Ready To Commit"?
Status | Pending | ⇒ | Ready to Commit |
Labels |
Added:
NPM Resource Changed
PR-5.2-dev
|
RTC
Can the PR get synced with the base branch
a task for Mantainers / Release Manager
I can do it, if this means "rebase to current 5.2-dev
top"
oh yes, forgot to mention that the pr author can do it
@NicolasDerumigny if you do it i'll restore the RTC status
Labels |
Added:
RTC
bug
|
There you go :)
Why not change it as suggested here? #44680 (comment)
In this case, both are strictly equivalent. I changed it that way to avoid confusion between currentTarget
and target
, and it is more natural for me to use button
which is a constant in the context of the event function rather that the variable e
, but this is clearly up to personal taste.
Status | Ready to Commit | ⇒ | Fixed in Code Base |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2025-01-17 16:58:44 |
Closed_By | ⇒ | Hackwar |
Thank you very much! Awesome find!
@NicolasDerumigny Can you change the title of the Pull Request to something more meaningful cause the title will be used in the changelog.
Maybe something like "[5.2] Fix for: Article cannot be saved successfully".