Special characters (&) are displayed as & in Select2 search results when attribute has many options

Describe the issue in as much detail as possible. Please remove the sections below if the issue is obvious enough and doesn’t require extra details.

Steps to reproduce

  1. Create a listing attribute of type select
  2. Add many options, some containing & in their label (e.g. Dolce & Gabbana, Tartine & Chocolat)
  3. Open the listing form and interact with the field
  4. Start typing in the Select2 search input

Actual result

When the number of options is large enough to trigger Select2’s search mode, labels containing & are displayed as & in the dropdown (e.g. Dolce & Gabbana).

This does not happen when the option count is low (simple select, no search input).

Expected result

Option labels should always render decoded characters regardless of the number of options and the Select2 rendering mode.

Extra details

Values are entered correctly in the back-office using &, not &. The issue appears to be in the Select2 results rendering, where HTML entities are not decoded before display. Reproduced on two separate environments (shared hosting and AWS). Screenshots attached.

Hi,

Thanks for the report.

The bug is confirmed and will be fixed in the next update.

1 Like

Hi Kseniia,

Thank you for confirming the bug.

Do you have an estimated timeframe for when this fix will be included in a release?

Unfortunately, this issue is currently blocking us from publishing several attributes because many brands contain the “&” character (e.g. Dolce & Gabbana, Bath & Body Works, Abercrombie & Fitch, etc.), and the rendered values look broken in the Select2 search results.

In the meantime, could you recommend a temporary workaround?

Would you suggest:

  • a custom filter/hook to decode the labels before rendering,

  • a JavaScript workaround on the Select2 results,

  • or any other safe approach that won’t conflict with the future fix?

We’d prefer to avoid maintaining a custom patch if a native fix is expected soon.

Thanks in advance.

We plan to have this delivered within the next two weeks.

Does this timeframe work for you, or would you prefer developer guidance to implement it sooner?

Hi Kseniia,

Thanks for the update.

That’s fine for us, we’ll wait for the official fix.

Thanks.

1 Like