Steps to reproduce:

  1. Enable the book module.
  2. Place the book navigation block in a region by itself.
  3. Choose to have it show only when on book pages.
  4. Go to a page that is not a book page, like /user/login.
  5. Inspect the page HTML and find that the region that the block was placed in renders, although it has no content in it, just the empty container.

It's pretty much invisible in Bartik, but in a theme where things were center justified instead of left justified, it would suddenly be apparent that something was wrong.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

kevin.dutra created an issue. See original summary.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.6 was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. (Drupal 8.4.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.4.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.4 was released on January 3, 2018 and is the final full bugfix release for the Drupal 8.4.x series. Drupal 8.4.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.5.0 on March 7, 2018. (Drupal 8.5.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.5.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.6 was released on August 1, 2018 and is the final bugfix release for the Drupal 8.5.x series. Drupal 8.5.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.6.0 on September 5, 2018. (Drupal 8.6.0-rc1 is available for testing.)

Bug reports should be targeted against the 8.6.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

lhguerra’s picture

I reproduced this and it is really annoying, because it makes the check for the region in page template useless (the region will always have something inside, even with no navigation available). I think I'll have to make some context tweak for the block.

boromino’s picture

boromino’s picture

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

tanubansal’s picture

Tested on drupal 9.1

1. I have assigned 'Book navigation' block to Featured bottom first region
2. When checking on /user/login, it shows an empty container for that particular region

Can we get a patch for 9.1 as well?

tanubansal’s picture

boromino’s picture

#8 works with 9.1.

tanubansal’s picture

After adding latest patch mentioned in #8, issue is resolved in 9.1
Now, its not showing any books empty container
RTBC + 1

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

franz’s picture

The dependency injection of current_user service is irrelevant to the patch.

Abhijith S’s picture

Patch #11 cant be applied on 9.2.x .Needs reroll

Checking patch core/modules/book/src/Plugin/Block/BookNavigationBlock.php...
error: while searching for:
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\RequestStack;
use Drupal\Core\Entity\EntityStorageInterface;

/**
 * Provides a 'Book navigation' block.

error: patch failed: core/modules/book/src/Plugin/Block/BookNavigationBlock.php:11
error: core/modules/book/src/Plugin/Block/BookNavigationBlock.php: patch does not apply
Abhijith S’s picture

Rerolled patch #11 for 9.2.x.Please check.

Madhu kumar’s picture

FileSize
68.69 KB

Patch #8 cant be applied , sharing screenshot for reference , Needs reroll for 9.2.x .

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

larowlan’s picture

This needs a reroll and #16 needs to be implemented

Also needs a test

ankithashetty’s picture

Rerolled the patch in #18 and also addressed #16, thanks!

Scott Weston’s picture

Status: Needs review » Reviewed & tested by the community

Reviewed and tested #23. Working as expected.

Testing Steps I took:
* Clean install of latest Drupal core standard installation profile.
* Enabled Book module.
* Place book navigation block in "Featured Top" region (with no other blocks).
* Verified featured top region is not output.

* Added book and pages.
* Confirmed Book Navigation block output in the Featured Top region.
* Navigated to a non-book page, confirmed that the Featured Top region is not output.

RTBC +1

larowlan’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: -Novice

Thanks folks, we still need a test here to demonstrate the bug.

The best place for this would be \Drupal\Tests\book\Functional\BookTest

The test should basically repeat the steps outlined by @Scott Weston, thanks 💪

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

quietone’s picture

Status: Needs work » Postponed

This extension is being deprecated, see #3376070: [Meta] Tasks to deprecate Book module. It will be removed from core and moved to a contrib project, #3376101: [11.x] [Meta] Tasks to remove Book.

This is now Postponed. The status is set according to two policies. The Remove a core extension and move it to a contributed project and the Extensions approved for removal policies.

This issue may be re-opened if it can be considered critical, If unsure, re-open the issue and ask in a comment.