Drupal 8.5.x-dev & commerce-8.x-2.x-dev

has inconsistent <div>parent
without id or class.

Twig doesn't output any suggestions before this <div>.

In source html i don't see cart block <section at all –
apparently it is added by JavaScript on page load, right?

I've changed theme, the block`s region,
turned of dc_ajax_add_cart module, cleared the cache – all stays the same.

Comments

Leagnus created an issue. See original summary.

Leagnus’s picture

Issue summary: View changes
Leagnus’s picture

Issue summary: View changes
Leagnus’s picture

Issue summary: View changes
megachriz’s picture

Status: Active » Postponed (maintainer needs more info)
Issue tags: -wrapper div around cart block

Can you post the full HTML code of the cart block? That would make it easier to see what exactly is wrong.

What do you mean with "inconsistent <div>parent"? Just a div tag without attributes? Or a div that isn't properly closed?

Leagnus’s picture

MegaChriz, a div tag without attributes

<div>
    <section id="block-cart" class="contextual-region block block-commerce-cart clearfix">
        <div data-contextual-id="block:block=cart:langcode=ru" class="contextual" role="form">
            ...
        </div>
        <div class="cart--cart-block">
            <div class="cart-block--summary">
            ...
            </div>
            <div class="cart-block--contents">
            ...
            </div>
        </div>
    </section>
</div>
mglaman’s picture

Status: Postponed (maintainer needs more info) » Closed (works as designed)

Anything beyond <div class="cart--cart-block"> is from your theme or the contextual module.

megachriz’s picture

The HTML code of the cart block (+ wrapper HTML) in the theme 'Bartik' with a fresh install of Commerce looks like this:

<div class="clearfix region region-header">
  <div id="block-bartik-branding" class="clearfix site-branding block block-system block-system-branding-block">
    <a href="/drupal/drupalsites/commerce8/web/" title="Home" rel="home" class="site-branding__logo">
      <img src="/drupal/drupalsites/commerce8/web/core/themes/bartik/logo.svg" alt="Home">
    </a>
    <div class="site-branding__text">
      <div class="site-branding__name">
        <a href="/drupal/drupalsites/commerce8/web/" title="Home" rel="home">Commerce testing</a>
      </div>
    </div>
  </div>
  <div id="block-shopping-cart" class="block block-commerce-cart">
    <div class="content">
      <div class="cart--cart-block">
        <div class="cart-block--summary">
          <a class="cart-block--link__expand" href="/drupal/drupalsites/commerce8/web/cart">
            <span class="cart-block--summary__icon"><img src="/drupal/drupalsites/commerce8/web/modules/contrib/commerce/icons/ffffff/cart.png" alt="Shopping cart" typeof="foaf:Image">
            </span>
            <span class="cart-block--summary__count">0 items</span>
          </a>
        </div>
      </div>
    </div>
  </div>
</div>

So the div tag without attributes is likely to come from your theme. I've seen div tags without attributes as well while developing my own theme. This seems to be related to Drupal outputting less CSS classes by default (compared to D7). Templates with (a lot of) default CSS classes have been moved to the theme 'classy'.

Leagnus’s picture

it's not Drupal commerce` issue: i've putted a views block into content region
and have set bartik as default –
result stayed the same: no twig tips before the div
no id or class in this div.

Somebody, please move this theme to Drupal 8.5 dev common branch of issues.

region.html.twig outputs this divs inside its {{ content }}

Leagnus’s picture

Status: Closed (works as designed) » Needs work
Leagnus’s picture

Project: Commerce Core » Drupal core
Version: 8.x-2.x-dev » 9.x-dev
Component: Cart » ajax system
Leagnus’s picture

Title: inconsistent cart block div wrapper » inconsistent block div wrapper in region.html.twig
Version: 9.x-dev » 8.5.x-dev
Component: ajax system » render system
Anonymous’s picture

Leagnus’s picture

vaplas, thank you, #270 removes the div.

effulgentsia’s picture

Status: Needs work » Closed (duplicate)

Thanks for the issue report and for tracking down the root issue in #13. Looks like this is a duplicate of that one, so closing it as such. Please reopen this issue if there's something not covered by that one. Thanks.