Problem/Motivation

Drupal has a JS Messages API to display messages from JavaScript - https://www.drupal.org/docs/drupal-apis/javascript-api/messages-api and it works well on the most of Drupal themes.

But with the Flexistyle theme, it doesn't work if no messages from the backend (generated by PHP) present on the website.

So, if a page already has a message, generated by PHP, new messages from JS appear correctly.
But if no messages from PHP side, no message appear after calling a JS Drupal Messages API.

Steps to reproduce

Test command to type in the Browser Console:

(new Drupal.Message()).add('Foo');
(new Drupal.Message()).add('Bar', {type: 'error'}); 

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

murz created an issue. See original summary.

murz’s picture

Status: Active » Needs review

I created a fix for this, please review.

anoopsingh92 made their first commit to this issue’s fork.

murz’s picture

@anoopsingh92, could you please review and merge this, and release a new version with the fix? Thank you!

murz’s picture

We use your theme in the commercetools demo here https://www.drupal.org/project/commercetools_online_demo so you can check the dropdown issue right there, just install the online demo, open the catalog page, and hover on the "Cart" block at the top-right.

  • anoopsingh92 committed bcc45a4b on 1.3.x authored by murz
    fix: #3563074 Drupal Messages from JS are not shown on the page if no...
anoopsingh92’s picture

Version: 1.3.x-dev » 1.3.9
Status: Needs review » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.