Active
Project:
Drupal core
Version:
main
Component:
base system
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
9 May 2019 at 21:36 UTC
Updated:
4 Sep 2020 at 10:15 UTC
Jump to comment: Most recent
Comments
Comment #2
joegl commentedFor more info: https://www.drupal.org/node/3002643
It doesn't make sense to me to force rendering of a block when it's empty. There also isn't a very good CSS approach off the top of my head for countering this (styling based on whether the block has content or not).
Comment #3
aramboyajyan commentedSame here. It seems that this would require applying styling to the messages themselves, which isn't the most practical thing if there are several wrappers for that region.
Does anyone know if there's a way to disable this from code?
Comment #4
johnpitcairn commentedHmm. The
system_messages_blockplugin itself is what is setting the relevant render element variable.You'd think setting the
#include_fallbackcontent key toFALSEintemplate_preprocess_block()would be able to kill this empty js messages fallback div, but no, that doesn't work.Comment #5
johnpitcairn commentedComment #6
joegl commentedComment #7
effulgentsia commentedIf all you want to do is remove the
data-drupal-messages-fallbackdiv, then you can do that by adding this preprocess function:However:
Drupal\Core\Render\Element\StatusMessages::generatePlaceholder()), so when the region renders, it always sees that placeholder as something that is not empty. While there are ways to override that, doing so would introduce bugs related to caching, which would then require additional workarounds to fix.Item 2 above has been how Drupal 8 has worked since 8.0. Are you sure you had a pre-8.7 site where the region didn't render at all? Are you able to reproduce that with core alone, or did that require additional contrib/custom code?
Comment #8
johnpitcairn commentedFair enough. I think the only reason I've noticed this new placeholder is that I'm building a minimal-markup theme to see how minimal I can go.
Comment #10
letrollpoilu commentedI'm also having this issue. The empty tag doesn't bother and the rendering of the empty region is a problem.
Is there a way of doing something like that to prevent the rendering?
I tried it and wasn't working....
Comment #12
mightyulysses commentedI'm experiencing this issue in 8.9. The preprocess function describe in #7 didn't work for me. Is there another preprocess I can use?
Comment #14
YnotB commentedThis worked for me using Drupal 8.8.6
function YOUR_THEME_preprocess_html(&$variables) {
$variables["page"]["content"]["messages"]["#include_fallback"] = false;
}