Does not work on JS-generated messages

Created on 17 October 2024, about 1 month ago

Problem/Motivation

  1. When messages are created using JavaScript Messages API , messages are not themed correctly. This also applies to AJAX messages created using MessageCommand .
  2. If a client has JavaScript disabled, messages do not appear at all.

Proposed resolution

Since 🐛 10.3 upgrade now missing status-message theme suggestions Postponed was implemented, themes in Drupal must (at least for the time being) style their status messages twice - PHP messages by using Twig, and JavaScript messages by overriding Drupal.theme.message(). This may change if 🐛 AJAX MessageCommand markup and styling differs from Theme default Needs work is resolved, but for now, we have to live with it.

This issue is a continuation of 🐛 Status Messages stopped working with D10.3 Active . The fix committed there fixes issue #2 above, but not #1. The proposed fix here resolves both issues, and aligns this module's behaviour more closely with how core works.

See core/themes/olivero/js/message.theme.js and core/themes/claro/js/messages.js for how this is implemented in core themes.

🐛 Bug report
Status

Active

Version

4.0

Component

Code

Created by

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

Comments & Activities

Production build 0.71.5 2024