RTC NPM Resource Changed bug PR-5.2-dev Pending

User tests: Successful: Unsuccessful:

avatar NicolasDerumigny
NicolasDerumigny
2 Jan 2025

Pull Request for Issue #37106 (or, at least, an issue having the exact same symptoms and behaviour).

Summary of Changes

Modify the element used for button data selector when using any button of the com_content edit form on the front-end.

Testing Instructions

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).

Actual result BEFORE applying this Pull Request

The article is not saved, as the POST request sent to the server has an empty task field.

Expected result AFTER applying this Pull Request

The article is correctly saved.

Link to documentations

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

avatar NicolasDerumigny NicolasDerumigny - open - 2 Jan 2025
avatar NicolasDerumigny NicolasDerumigny - change - 2 Jan 2025
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 2 Jan 2025
Category JavaScript Repository NPM Change
avatar fgsw
fgsw - comment - 2 Jan 2025

@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".

avatar NicolasDerumigny NicolasDerumigny - change - 2 Jan 2025
Title
Fix #37106
[5.2] Fix for: Article cannot be saved successfully
avatar NicolasDerumigny NicolasDerumigny - edited - 2 Jan 2025
avatar NicolasDerumigny NicolasDerumigny - change - 2 Jan 2025
The description was changed
avatar NicolasDerumigny NicolasDerumigny - edited - 2 Jan 2025
avatar NicolasDerumigny
NicolasDerumigny - comment - 2 Jan 2025

Of course. That's done!

avatar fgsw
fgsw - comment - 4 Jan 2025

Save by clicking specifically on the checkbox icon in the save button (so that the event.target is the span.icon-check).

Can you provide a screenshot where to click or explain in another way?

avatar NicolasDerumigny
NicolasDerumigny - comment - 4 Jan 2025

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:
image
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.

avatar fgsw
fgsw - comment - 4 Jan 2025

Thanks but can you provide a screenshot where to click to get the bug?

avatar NicolasDerumigny
NicolasDerumigny - comment - 4 Jan 2025

Of course, it's on the blue section here (in the front-end only):
image

avatar fgsw fgsw - test_item - 4 Jan 2025 - Tested successfully
avatar fgsw
fgsw - comment - 4 Jan 2025

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."?


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/44680.
avatar NicolasDerumigny NicolasDerumigny - change - 4 Jan 2025
Title
[5.2] Fix for: Article cannot be saved successfully
[5.2] Fix for: Article cannot be saved successfully on the front-end
avatar NicolasDerumigny NicolasDerumigny - edited - 4 Jan 2025
avatar NicolasDerumigny NicolasDerumigny - change - 4 Jan 2025
The description was changed
avatar NicolasDerumigny NicolasDerumigny - edited - 4 Jan 2025
avatar NicolasDerumigny
NicolasDerumigny - comment - 4 Jan 2025

That's done! Let me know if you need anything else!

avatar C-Lodder
C-Lodder - comment - 6 Jan 2025

Note, you can also use e.currentTarget

avatar chmst chmst - test_item - 15 Jan 2025 - Tested successfully
avatar chmst
chmst - comment - 15 Jan 2025

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.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/44680.

avatar fgsw
fgsw - comment - 16 Jan 2025

Can the PR get synced with the base branch and set as "Ready To Commit"?

avatar alikon alikon - change - 16 Jan 2025
Status Pending Ready to Commit
Labels Added: NPM Resource Changed PR-5.2-dev
avatar alikon
alikon - comment - 16 Jan 2025

RTC


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/44680.

avatar alikon
alikon - comment - 16 Jan 2025

Can the PR get synced with the base branch

a task for Mantainers / Release Manager

avatar fgsw
fgsw - comment - 16 Jan 2025

a task for Mantainers / Release Manager

@alikon Thanks for info. I thought it has to be the other way round.

avatar NicolasDerumigny
NicolasDerumigny - comment - 16 Jan 2025

I can do it, if this means "rebase to current 5.2-dev top"

avatar alikon
alikon - comment - 16 Jan 2025

oh yes, forgot to mention that the pr author can do it
@NicolasDerumigny if you do it i'll restore the RTC status

avatar NicolasDerumigny NicolasDerumigny - change - 16 Jan 2025
Labels Added: RTC bug
avatar NicolasDerumigny
NicolasDerumigny - comment - 16 Jan 2025

There you go :)

avatar QuyTon
QuyTon - comment - 16 Jan 2025

Why not change it as suggested here? #44680 (comment)

avatar NicolasDerumigny
NicolasDerumigny - comment - 16 Jan 2025

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.

avatar Hackwar Hackwar - change - 17 Jan 2025
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
avatar Hackwar Hackwar - close - 17 Jan 2025
avatar Hackwar Hackwar - merge - 17 Jan 2025
avatar Hackwar
Hackwar - comment - 17 Jan 2025

Thank you very much! Awesome find!

Add a Comment

Login with GitHub to post a comment