Skip to content

Widget not inserting or saving when the word ‘type’ is used anywhere in the text after a quotation mark

For a little context, we have recently made the decision to disable page builder and move towards a component-driven content entry approach utilising widgets. We have a “Generic Text” widget, which consists of a custom WYSIWYG parameter.

Whilst testing this widget, we came across a rather odd (and probably quite specific) problem, which is that if a quotation mark is present in the text, and then the word type is present anywhere in the preceding text, the widget fails to insert or save and completely disappears from the editor.

Steps to reproduce

Ensure Page Builder is disabled, and you’re using the standard TinyMCE editor.

  1. Create, or edit an existing, page
  2. Click insert widget button/icon
  3. Choose CMS Page Link Enter " type into ‘Anchor Custom Text’
  4. Insert the widget

You should find that the widget modal retracts, and you’re left with:

  • If you created a new page, a blank editor
  • If you edited a page, the inserted widget won’t be present

The same happens when trying to save a widget which existing content:

  1. Insert a new widget (without " type and save it), or edit an existing widget
  2. Edit the content of a text field so that " type is now included
  3. Save the widget

Raised on Magento 2 GitHub

The issue has been raised on the Magento 2 GitHub (#38711), and has been verified and replicated on a fresh 2.4-develop Luma theme environment.

If anyone is able to contribute towards this, or suggest a temporary fix until Magento applies a patch, that would be greatly appreciated.