In between button title is double escaped

Created on 23 February 2023, over 1 year ago
Updated 28 March 2023, over 1 year ago

Problem/Motivation

When we have a paragraph type which label contains a quote (or a few other special chars), its label ends up being double escaped in the buttons title. That's because Drupal.t() converts these chars to htmlentities (to mirror what's done in PHP) then Element.setAttribute() escapes that value again because it does not expect to get any HTML.

Steps to reproduce

  1. Create a paragraph type which label contains a quote
  2. Configure one content type to allow to reference this paragraph type
  3. Configure the widget to show the add in between buttons

Expected: the button's title attribute is human readable
Current: the button's title attribute contains escaped html entities

Proposed resolution

Use a DOMParser trick to convert entities back before setting the button title.

πŸ› Bug report
Status

Fixed

Version

2.1

Component

Code

Created by

πŸ‡«πŸ‡·France DuaelFr Montpellier, France

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.69.0 2024