Problem/Motivation

I have the book navigation block in the sidebar. On non-book pages where the navigation would be empty, it still produces some whitespace which makes the page template think there is a sidebar.

Steps to reproduce

Place book navigation block in sidebar, nothing else. Check markup output.

Proposed resolution

Don't produce whitespace content for empty block and/or don't consider whitespace content a sidebar in the page template.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Issue fork drupal-3421433

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

Gábor Hojtsy created an issue. See original summary.

mherchel’s picture

This is likely related to #953034: [meta] Themes improperly check renderable arrays when determining visibility. I wonder if within region--sidebar.html.twig, if we change the {% if content %} to {% if content.0 %}, if that'd be a good enough fix. It seems to solve the problem on my local.

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

gauravvvv’s picture

If we change {% if content %} to {% if content.0 %} then it doesn't display the aside region even if we add any block in aside region.

gauravvvv’s picture

Also, I printed the length of content in sidebar having Book navigation menu, {{ content|length }} and the output is 215. It seems to be an issue with the block itself.

gábor hojtsy’s picture

Maybe its the book navigation block only. It adds the olivero book library (got it, library, haha?!) even if there was no content in the block.

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.