Hello,

i´m not sure if this bug is reported in the right issue-list, but i hope so.
I´m using Drupal 8.1.1. Today i enabled big-pipe for testing and i found this strange bug.
Scenario:
I have several menus in the header section combined to an unordered list. Each menu is in a block and in an list-element. My CSS works fine for anonymous and logged-in users.
When i enable big-pipe the menu block for the language-switcher will be surrounded by a div-element which destroys my CSS. All other blocks are same as without big-pipe.

Any ideas why this happen? I checked the twig-templates. They´re still looking good and i can´t find out when and why this div is added.

In the attachment you can see my basic header section. Maybe this will help

Best,
Phil_b

CommentFileSizeAuthor
menu_structure.txt493 bytesPhil_b
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Phil_b created an issue. See original summary.

Fabianx’s picture

Project: BigPipe » Drupal core
Version: 8.x-1.1 » 8.2.x-dev
Component: User interface » big_pipe.module

Moving to the right queue.

Yes, indeed the DIVs are left on the page, when we replace the placeholder.

This could be solved by the custom templates for big pipe placeholders (other issue).

Or maybe you could change the div to be displayed as 'inline'. While we don't have a special class, I think there is a data attribute you could check for non-empty.

Maybe we should add a class?

@Wim: Thoughts?

Wim Leers’s picture

Title: Problems with big_pipe, logged_in users and the language switcher » BigPipe leaves wrapper <div>s in place, because AJAX system leaves them — this can cause some CSS to break
Version: 8.2.x-dev » 8.1.x-dev
Priority: Normal » Major

AFAICT this is a bug in the AJAX system.

Wim Leers’s picture

Title: BigPipe leaves wrapper <div>s in place, because AJAX system leaves them — this can cause some CSS to break » [PP-1] BigPipe leaves wrapper <div>s in place, because AJAX system leaves them — this can cause some CSS to break
Status: Active » Postponed
Related issues: +#736066: ajax.js insert command sometimes wraps content in a div, potentially producing invalid HTML and other bugs

Confirmed. And yes, this is the AJAX system biting us.

BigPipe uses \Drupal\Core\Ajax\ReplaceCommand, which uses http://api.jquery.com/replaceWith/. But thanks to this stuff in ajax.js, we're left with that wrapping <div>:

      // We don't know what response.data contains: it might be a string of text
      // without HTML, so don't rely on jQuery correctly interpreting
      // $(response.data) as new HTML rather than a CSS selector. Also, if
      // response.data contains top-level text nodes, they get lost with either
      // $(response.data) or $('<div></div>').replaceWith(response.data).
      var $new_content_wrapped = $('<div></div>').html(response.data);
      var $new_content = $new_content_wrapped.contents();

This is therefore a duplicate of #736066: ajax.js insert command sometimes wraps content in a div, potentially producing invalid HTML and other bugs, which is a >6 year old major bug.

But let's keep this issue open, to make it easier for BigPipe users to find out about this problem. Marking as blocked on that issue, so that we can close both at the same time.

Wim Leers’s picture

Wim Leers’s picture

Oh, hah, this exact problem has been reported before to BigPipe: #2654386: [PP-1] BigPipe uses AJAX system to insert new content, AJAX system adds a wrapping <div>, breaks theme. It just was still in the contrib module's issue queue. Moved it to Drupal core.

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

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.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.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.

leymannx’s picture

Found another occurrence of this bug when using https://www.drupal.org/project/blockgroup together with BigPipe. Empty <div> containers around all Block Groups when BigPipe enabled and logged in. Breaks CSS. Disabling BigPipe fixed it :'(

Wim Leers’s picture

#10: reported at #736066-262: ajax.js insert command sometimes wraps content in a div, potentially producing invalid HTML and other bugs, thanks for letting me know. (Note that you can work around it by tweaking your CSS selectors.)

#2913563: Facets blocks loaded with BigPipe wrapped in unwanted <div> due to bug in AJAX system was also just brought to my attention, that was yet another duplicate of this.

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.

Wim Leers’s picture

Title: [PP-1] BigPipe leaves wrapper <div>s in place, because AJAX system leaves them — this can cause some CSS to break » BigPipe leaves wrapper <div>s in place, because AJAX system leaves them — this can cause some CSS to break
Version: 8.5.x-dev » 8.6.x-dev
Status: Postponed » Fixed

Status: Fixed » Closed (fixed)

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