Problem/Motivation

At some point along the way, it looks like Drupal changed how #markup was being filtered. In your module, you have the iframe being constructed like this:

$attributes = 'height="0" width="0" style="display:none;visibility:hidden;"';
$noscript = "<noscript><iframe src=\"{$src}\" {$attributes}></iframe></noscript>";

However if you look at the webpage output, the iframe is being rendered with the inline style attribute removed:

<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-XXXXXXX" height="0" width="0"></iframe></noscript>

This causes some accessibility issues because some screen readers will try to process the iframe.

Proposed resolution

Change the logic to build the iframe using the html_tag render type instead of trying to directly work with the html. The attached patch does that and in my testing the iframe is being output correctly again.

CommentFileSizeAuthor
gtm_fix-iframe-rendering.patch924 bytesjacobbell84

Comments

jacobbell84 created an issue. See original summary.

jacobbell84’s picture

Status: Active » Needs review
matija5’s picture

Status: Needs review » Reviewed & tested by the community

Confirming inline style attribute is being removed from iframe. By applying gtm_fix-iframe-rendering.patch iframe is rendered with inline styles.

apolitsin’s picture

Status: Reviewed & tested by the community » Fixed

thank you so much!
Fixed in #3130293: gtm 8.x-1.2

Status: Fixed » Closed (fixed)

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

jacobbell84’s picture