HTML tags appear in 'Not exist' and 'Not found' messages

Created on 18 October 2024, 2 months ago

Problem/Motivation

When a match is not found, the HTML tags in the default 'Not exist' and 'Not found' messages appear as plain text in the rendered messages, e.g. 'No matches found, Press Enter to add <strong>'foobar'</strong>'.

Screenshot from a clean instance of Drupal 10.3.5.

Steps to reproduce

In a field using an active_tags widget, enter a value that doesn't exist.

πŸ› Bug report
Status

Active

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States justcaldwell Austin, Texas

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

Comments & Activities

  • Issue created by @justcaldwell
  • πŸ‡ΊπŸ‡ΈUnited States justcaldwell Austin, Texas

    Drupal.t() will pass strings through \Drupal\Component\Utility\Html::escape(). Not sure if there's an easy way to allow HTML in javascript like this.

  • πŸ‡©πŸ‡ͺGermany berliner

    Run into this too and I don't think that we can pass HTML markup in Drupal.t().

    I have created a patch that changes the way these default strings are handled and how translation can happen now. Not sure this covers all use cases, but I'll attach it here for review.

  • πŸ‡΅πŸ‡±Poland mahyarss

    Thank you @justcaldwell for reporting this issue and @berliner for providing a patch to address it!

    I have reviewed and applied the patch, and the issue has been resolved. The fix is now included in the latest development version: 1.0.x-dev (updated on 6 Dec 2024). It will also be available in the upcoming stable release.

    Your contributions are greatly appreciated. If you have further feedback or encounter any related issues, please feel free to share!

  • πŸ‡©πŸ‡ͺGermany berliner

    Great! Looking forward to a stable release then.
    This is a great module!

Production build 0.71.5 2024