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

Graceful Handling of Null element in Page Builder to Prevent Editor Failure #866

Open
Stevie-Ray opened this issue Mar 12, 2024 · 2 comments

Comments

@Stevie-Ray
Copy link

I've encountered a scenario where the Page Builder's HTML content can become corrupted, leading to potential runtime errors in the script responsible for handling HTML elements. Specifically, the issue arises from the code segment designed to apply styles by setting attributes on elements selected via a CSS selector. When the expected HTML element is absent (null), attempting to call setAttribute on it directly causes the entire Page Builder to halt, preventing users from further editing their pages.

The code segment can be found here:

To enhance the resilience of the Page Builder and ensure that such HTML content issues do not disrupt the editing process, I propose adding a simple existence check for the element before attempting to call setAttribute on it. This small safeguard will allow the rest of the Page Builder's functionality to continue operating normally, even if specific elements are not found, thereby improving the user experience and stability of the editor in edge cases.

Implementing this change could significantly reduce the impact of content errors on the Page Builder's usability, ensuring that clients can continue editing their pages without interruption.

This rewrite aims to clearly describe the issue, its impact on the user experience, and propose a specific solution, making it easier for the Magento development team to understand and address the problem.

Copy link

m2-assistant bot commented Mar 12, 2024

Hi @Stevie-Ray. Thank you for your report.
To speed up processing of this issue, make sure that you provided sufficient information.
Add a comment to assign the issue: @magento I am working on this


Join Magento Community Engineering Slack and ask your questions in #github channel.

@artttj
Copy link

artttj commented Aug 30, 2024

@magento I am working on this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Ready for Grooming
Development

No branches or pull requests

2 participants