Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[5.2] Fix for: Article cannot be saved successfully on the front-end #44680

Open
wants to merge 1 commit into
base: 5.2-dev
Choose a base branch
from

Conversation

NicolasDerumigny
Copy link

@NicolasDerumigny NicolasDerumigny commented Jan 2, 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

@joomla-cms-bot joomla-cms-bot added NPM Resource Changed This Pull Request can't be tested by Patchtester PR-5.2-dev labels Jan 2, 2025
@fgsw
Copy link

fgsw commented Jan 2, 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".

@NicolasDerumigny NicolasDerumigny changed the title Fix #37106 [5.2] Fix for: Article cannot be saved successfully Jan 2, 2025
@NicolasDerumigny
Copy link
Author

Of course. That's done!

@fgsw
Copy link

fgsw commented Jan 4, 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?

@NicolasDerumigny
Copy link
Author

NicolasDerumigny commented Jan 4, 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.

@fgsw
Copy link

fgsw commented Jan 4, 2025

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

@NicolasDerumigny
Copy link
Author

NicolasDerumigny commented Jan 4, 2025

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

@fgsw
Copy link

fgsw commented Jan 4, 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.

@NicolasDerumigny NicolasDerumigny changed the title [5.2] Fix for: Article cannot be saved successfully [5.2] Fix for: Article cannot be saved successfully on the front-end Jan 4, 2025
@NicolasDerumigny
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NPM Resource Changed This Pull Request can't be tested by Patchtester PR-5.2-dev
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants