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.
| Comment | File | Size | Author |
|---|---|---|---|
| gtm_fix-iframe-rendering.patch | 924 bytes | jacobbell84 |
Comments
Comment #2
jacobbell84 commentedComment #3
matija5 commentedConfirming inline style attribute is being removed from iframe. By applying gtm_fix-iframe-rendering.patch iframe is rendered with inline styles.
Comment #5
apolitsin commentedthank you so much!
Fixed in #3130293: gtm 8.x-1.2
Comment #7
jacobbell84 commented