Problem/Motivation
Issue with Message in Drupal site
Steps to reproduce
Install Drupal 11
create or edit any node.
![]()
Proposed resolution
Remove extra icon.
Adding a condition to verify that the close button is not present in the message container, then only adding the close button fixes the bug.
if (!messageContainer.querySelector('.messages__button')){}
Remaining tasks
User interface changes
API changes
Data model changes
Release notes snippet
| Comment | File | Size | Author |
|---|---|---|---|
| #12 | Screenshot from 2024-03-04 11-45-45.png | 23.75 KB | adwivedi008 |
| #11 | Screenshot from 2024-02-28 14-00-34.png | 6.56 KB | dineshkumarbollu |
| #6 | Screenshot from 2024-02-24 17-36-51.png | 1015 bytes | pravesh_poonia |
| message_close icon.png | 24.23 KB | dineshkumarbollu |
Issue fork drupal-3423384
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:
- 3423384-extra-close-icon
changes, plain diff MR !6753
Comments
Comment #4
govind_giri_goswami commentedchanges in closeMessage() function, which adds a close button to a message container if one doesn't already exist, and hides the message when the close button is clicked
Comment #5
smustgrave commentedWould be good to add solution to the issue summary.
Comment #6
pravesh_poonia commentedApplied MR 6753, Mentioned issue fixed
Comment #7
tanuj. commentedComment #8
shreyal999 commentedThe code should have indentation or line gap as in the previous version for code clarity.
Comment #10
kostyashupenkoWondering what is the cause of that fact that
once()in that case doesn't actually work (works 2 times)Comment #11
dineshkumarbollu commentedConfirm MR fixes the issue.
Comment #12
adwivedi008 commentedI tested the MR mentioned in #4, and it fixes the issue
So moving the issue to RTBC
Comment #16
nod_when bigpipe is enabled, the status message comes from a bigpipe/ajax command.
The message commands adds a new message using Drupal.theme('message') it calls olivero implementation of the theme function that adds a close button. Nothing is using once at this point. Then when the page loads, behaviors are called, and a second close button is added to the message. Once is working as expected it's just not at the right place.
Theme functions should be returning plain strings instead of objects, that would have prevent the double initialization.
Fix makes sense in this situation.
Comment #21
nod_Committed 068b95a and pushed to 11.x. Thanks!