magento2
magento2 copied to clipboard
Multiple HTML attributes not editable on Categories
Preconditions and environment
CE 2.4.7
Needs a custom category text attribute to be added that uses the WYSIWYG editor. See the web for example of how to do that.
This arose after upgrading from 2.4.3 to 2.4.7. Upgrade went through 2.4.4, 2.4.5 & 2.4.6 so no idea what version this bug appeared in.
Steps to reproduce
-
Add a custom text category attribute e.g. https://developer.adobe.com/commerce/frontend-core/ui-components/howto/add-category-attribute/
-
Add to the category edit page as wysiwyg i.e.
<field name="custom_description" template="ui/form/field" sortOrder="100" formElement="wysiwyg">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="wysiwygConfigData" xsi:type="array">
<item name="height" xsi:type="string">100px</item>
<item name="add_variables" xsi:type="boolean">false</item>
<item name="add_widgets" xsi:type="boolean">false</item>
<item name="add_images" xsi:type="boolean">true</item>
<item name="add_directives" xsi:type="boolean">true</item>
</item>
<item name="source" xsi:type="string">category</item>
</item>
</argument>
<settings>
<label translate="true">Below Description</label>
<dataScope>custom_description</dataScope>
</settings>
<formElements>
<wysiwyg class="Magento\Catalog\Ui\Component\Category\Form\Element\Wysiwyg">
<settings>
<rows>8</rows>
<wysiwyg>true</wysiwyg>
</settings>
</wysiwyg>
</formElements>
</field>
-
Try to edit the field on the category - it won't save. Note in our case our custom fields already have values that display on the frontend but do not show on the backend. Changes do not save,
-
Change the sort order of the field to 49 and try again., This time you can edit and save the custom attribute but not the normal Description field.
-
Change the sort order back to 100 and make the field a basic textarea field e.g.
<field name="custom_description" sortOrder="100" formElement="textarea">
<settings>
<dataType>string</dataType>
<label translate="true">My Text Attribute</label>
</settings>
</field>
Now you can edit and save the field as text.
Expected result
We are able to edit all HTML fields on the category page.,
Actual result
We can only edit the first HTML field that appears on the category page.
Additional information
Custom attribute editor empty:
Move custom attribute before core description, now description empty:
Make custom attribute a standard textarea and works ok:
Release note
Fix bug introduced in 2.4.? that prevents editing of additional custom HTML attributes on categories.
Triage and priority
- [X] Severity: S0 - Affects critical data or functionality and leaves users without workaround.
- [ ] Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
- [ ] Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
- [ ] Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
- [ ] Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.
Hi @adamlavery. Thank you for your report. To speed up processing of this issue, make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, Add a comment to the issue:
@magento give me 2.4-develop instance- upcoming 2.4.x release- For more details, review the Magento Contributor Assistant documentation.
- Add a comment to assign the issue:
@magento I am working on this - To learn more about issue processing workflow, refer to the Code Contributions.
Join Magento Community Engineering Slack and ask your questions in #github channel. :warning: According to the Magento Contribution requirements, all issues must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting. :clock10: You can find the schedule on the Magento Community Calendar page. :telephone_receiver: The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, join the Community Contributions Triage session to discuss the appropriate ticket.
@magento give me 2.4-develop instance
Hi @adamlavery. Thank you for your request. I'm working on Magento instance for you.
Hi @adamlavery, here is your Magento Instance: https://12a2515e68f0a3e05523ef31d44dfa90.instances-prod.magento-community.engineering Admin access: https://12a2515e68f0a3e05523ef31d44dfa90.instances-prod.magento-community.engineering/admin_f260 Login: a7d8dd33 Password: c32eb466d8d3
How do we get SSH access to this to be able to add a test module?
Hi @engcom-Dash. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:
-
- Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).
-
- Verify that issue has a meaningful description and provides enough information to reproduce the issue.
-
- Add
Area: XXXXXlabel to the ticket, indicating the functional areas it may be related to.
- Add
-
- Verify that the issue is reproducible on
2.4-developbranchDetails
- Add the comment@magento give me 2.4-develop instanceto deploy test instance on Magento infrastructure.
- If the issue is reproducible on2.4-developbranch, please, add the labelReproduced on 2.4.x.
- If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!
- Verify that the issue is reproducible on
- Join Magento Community Engineering Slack and ask your questions in #github channel.
Hi @engcom-Delta. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:
- [ ] 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).
- [ ] 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue.
- [ ] 3. Add
Area: XXXXXlabel to the ticket, indicating the functional areas it may be related to. - [ ] 4. Verify that the issue is reproducible on
2.4-developbranchDetails
- Add the comment@magento give me 2.4-develop instanceto deploy test instance on Magento infrastructure.
- If the issue is reproducible on2.4-developbranch, please, add the labelReproduced on 2.4.x.
- If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here! - [ ] 5. Add label
Issue: Confirmedonce verification is complete. - [ ] 6. Make sure that automatic system confirms that report has been added to the backlog.
+1 to this issue.
Hi @engcom-Hotel. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:
- [ ] 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).
- [ ] 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue.
- [ ] 3. Add
Area: XXXXXlabel to the ticket, indicating the functional areas it may be related to. - [ ] 4. Verify that the issue is reproducible on
2.4-developbranchDetails
- Add the comment@magento give me 2.4-develop instanceto deploy test instance on Magento infrastructure.
- If the issue is reproducible on2.4-developbranch, please, add the labelReproduced on 2.4.x.
- If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here! - [ ] 5. Add label
Issue: Confirmedonce verification is complete. - [ ] 6. Make sure that automatic system confirms that report has been added to the backlog.
Hello @adamlavery,
Thanks for the report and collaboration!
We have tried to reproduce the issue by upgrading the Magento from 2.4.3 to 2.4.7-p1 (The latest released version). But it seems the issue is not reproducible for us. After upgrading we can see the saved value from the previous version i.e. 2.4.3.
Please refer to the below screenshot for reference:
We are also attaching the module we have created to reproduce the issue: Magentoissues.zip
Let us know in case we missed anything.
Thanks
@engcom-Hotel this really doesn't demonstrate the issue. Try moving your custom attribute into Content and display after the core Description field (i.e. sortOrder 51+). As per this test, your custom attribute is the first HTML field on the page and that works. I suspect if you open Content you'll find you can't change Description. But do as we have done to exactly reproduce our scenario.
Hello @adamlavery,
Thanks for the response.
As per your response, we have made the required changes in the module and have moved the custom category attribute to Display Settings. However, we still cannot reproduce the issue.
We followed the entire upgrade process from 2.4.3 to 2.4.7-p1. Please refer to the screenshot below for reference:
Let us know if we have missed anything.
Thanks
Hi @engcom-Hotel , ok so this time you have put it in the Display Settings section. Put it in the Content section, below Description as per the screenshots.
Adobe broke it when was fixing static tests.
Long story short:
This is the fix. Just replace for...var cycle to .forEach cycle in domObserver:processAdded function back.
It is a shame guys, that you are saying that you could not even reproduce it. it is 100% reproducible everywhere
Hello @adamlavery, @skovalenk,
It is a shame guys, that you are saying that you could not even reproduce it. it is 100% reproducible everywhere
I apologize but we are trying our best in this issue reproduction.
We have tried again and now the custom field is in the Content section below the description field. Please refer to the screenshot below for reference:
But the issue is not reproducible for us. Just so you know, we are attaching the module as well, please let us know if we missed anything.
Thanks
Thanks @skovalenk - I can confirm that reverting dom-observer.js back to the original version fixes the issue.
I noticed there are many instances of the same kind of change in that script, I guess any one of which could be causing other issues yet to be discovered. Hence I reverted the whole script. I may be wrong but this seems to me a case of someone rewriting this code for the sake of rewriting it the way they prefer to do it. Can't see that the changes add anything - other than new bugs!!
Clearly the automated test scripts are not up to much as they haven't picked up that this "fix" actually creates a new bug.
Too much of this happens in Magento nowdays. Old adage: if it ain't broke don't fix it - changing it might actually break it!!! Whoever made this change needs to review what they did (and why).
@engcom-Hotel try specfying the field in the same way we have i.e. same XML. Your XML is different. For some reason your label doesn't display. Who know's what effect a slightly different way of adding the field might be having in the black-box that is Magento UI.
That's been one of the big issues of M2 UI - too many different ways to do the same thing. Can't wait to see the whole over-engineered mess stripped out and replaced wth something much simpler - like Hyva.
@engcom-Hotel another slight difference - your attribute is varchar, ours is text.
Hello @adamlavery,
We can reproduce the issue now. After the upgrade, we cannot see the values in the custom attribute. Please refer to the below screenshots for reference:
If the Custom attribute is below the description field
_We can’t see the value in the custom attribute
If the Custom attribute is above the description field
_We can see the value in the custom attribute
Hence confirming the issue.
Thanks
:white_check_mark: Jira issue https://jira.corp.adobe.com/browse/AC-12434 is successfully created for this GitHub issue.
:white_check_mark: Confirmed by @engcom-Hotel. Thank you for verifying the issue.
Issue Available: @engcom-Hotel, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.
I have the feeling this might have already been fixed in 2.4-develop with https://github.com/magento/magento2/pull/38623, but I might be wrong.
@engcom-Hotel: did you only test it while upgrading Magento to 2.4.7, or did you then also test it by further upgrading to the latest 2.4-develop version?
I can confirm that this commit fixes the issue: 1933e66
Okay perfect, then I guess we can close this issue, the fix is probably scheduled to be delivered in Magento 2.4.8
I have the feeling this might have already been fixed in 2.4-develop with #38623, but I might be wrong.
@engcom-Hotel: did you only test it while upgrading Magento to 2.4.7, or did you then also test it by further upgrading to the latest
2.4-developversion?
Hello @hostep,
We have tried it in both 2.4-develop (the latest development branch) and via upgrading. The issue is not reproducible in 2.4-develop but it is reproducible in upgrading from 2.4.3 to 2.4.7-p1 (the latest released version).
So as per my suggestion, the issue should remain open, for upgrading scenario.
Thanks
@hostep - agreed! This has nothing to do with upgrading from one release to another. It's a coding error introduced by https://github.com/magento/magento2/pull/37477.
Is it not considered serious enough to go in the next patch release? How can we know which release includes it?
@engcom-Hotel: ticket can be closed in my opinion, it's a bug in the code that has introduced the problem, not the upgrade process itself. The reason why it's not reproducible in 2.4-develop is because the fix was already introduced in 2.4-develop on 28 May 2024
@adamlavery: I assume this fix will get included in Magento 2.4.8 and not in one of the security patch releases. I don't think Adobe considers it as highly critical.
Just patch your codebase to fix the bug if you need it urgently, using one of the well known composer patch libraries (https://github.com/vaimo/composer-patches or https://github.com/cweagans/composer-patches/ or ...).
Sure @hostep. We are closing the issue.
Thanks