When I add a context filter, my view is wrapped in a div I created a view block to display a button (join / leave) above my groups. When I add a context filter to my view, it is wrapped in a div without "class" and "id".

1) I added to my view the following context filter:

(Group content User) User: User ID

2) When the filter value is NOT available: Provide a default value: User ID of the logged in user

Here is the result :

&lt;div&gt;&lt;section class="views-element-container block block-views block-views-blockgroup-button-rejoindre-ou-quitter-block-1 clearfix" id="block-views-block-group-button-rejoindre-ou-quitter-block-1"&gt;



      &lt;div class="form-group"&gt;&lt;div class="view view-group-button-rejoindre-ou-quitter view-id-group_button_rejoindre_ou_quitter view-display-id-block_1 js-view-dom-id-7e52cd584bd1944bf2360a966e72384fc9e36069f506a9b448a39dde191c802e"&gt;



      &lt;div class="view-empty"&gt;
      &lt;a class="btn btn-success" href="/group/2/join"&gt;&lt;i class="fa fa-sign-in"&gt;&lt;/i&gt; Rejoindre le groupe&lt;/a&gt;
    &lt;/div&gt;

          &lt;/div&gt;
&lt;/div&gt;

  &lt;/section&gt;

&lt;/div&gt;


If I delete the context filter, the div envelope would disappear, but that's not the view I want:

&lt;section class="views-element-container block block-views block-views-blockgroup-button-rejoindre-ou-quitter-block-1 clearfix" id="block-views-block-group-button-rejoindre-ou-quitter-block-1"&gt;



      &lt;div class="form-group"&gt;&lt;div class="view view-group-button-rejoindre-ou-quitter view-id-group_button_rejoindre_ou_quitter view-display-id-block_1 js-view-dom-id-66463110f7422801aaa138cc3887e2da44cb7833e8200c59f0e952de0bc55d5e"&gt;



      &lt;div class="view-content"&gt;
          &lt;div class="views-row"&gt;
    &lt;div class="views-field views-field-id"&gt;&lt;span class="field-content btn btn-danger"&gt;&lt;a href="/group/2/leave"&gt;&lt;i class="fa fa-sign-out"&gt;&lt;/i&gt; Quitter le groupe&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;
  &lt;/div&gt;
    &lt;div class="views-row"&gt;
    &lt;div class="views-field views-field-id"&gt;&lt;span class="field-content btn btn-danger"&gt;&lt;a href="/group/2/leave"&gt;&lt;i class="fa fa-sign-out"&gt;&lt;/i&gt; Quitter le groupe&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;
  &lt;/div&gt;

    &lt;/div&gt;

          &lt;/div&gt;
&lt;/div&gt;

  &lt;/section&gt;


I encounter this problem with other block view, it's really weird. An idea ?
Check the twig template (by turning on twig debugging) that is generating the div for your contextual filter. Then alter it with an ID or Class tag. 

Let me know if you need help turning on twig debugging.  

Find the twig template that is generating that div, copy it and rename it with one of the FILE NAME SUGGESTIONS. The add the following code to the div. 

&lt;div{{ attributes.addClass('my-class') }}&gt;&lt;/div&gt;