From 7cf605b8e3a1dd92773420deb0c4fe3a5da5e391 Mon Sep 17 00:00:00 2001 From: honzalo Date: Tue, 10 Sep 2024 10:20:23 +0100 Subject: [PATCH] =?UTF-8?q?=E2=99=BF=20[amp-consent]=20fix:=20amp-consent?= =?UTF-8?q?=20iframe=20title=20for=20accessibility=20(#40047)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: amp-consent iframe title for accesibility * fix: title origin * fix: lint issue * fix: move setAttribute with other setAttributes * fix: remove unnecessary title on iframe --- extensions/amp-consent/0.1/amp-consent.js | 1 - extensions/amp-consent/0.1/consent-ui.js | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/extensions/amp-consent/0.1/amp-consent.js b/extensions/amp-consent/0.1/amp-consent.js index bdef57d8e1f4..e0fbccc9d8e9 100644 --- a/extensions/amp-consent/0.1/amp-consent.js +++ b/extensions/amp-consent/0.1/amp-consent.js @@ -1035,7 +1035,6 @@ export class AmpConsent extends AMP.BaseElement { // Set up the __tcfApiLocator window to signal postMessage support const iframe = this.element.ownerDocument.createElement('iframe'); - iframe.setAttribute('title', this.element.title || 'Consent Banner'); iframe.setAttribute('name', TCF_API_LOCATOR); iframe.setAttribute('aria-hidden', 'true'); toggle(iframe, false); diff --git a/extensions/amp-consent/0.1/consent-ui.js b/extensions/amp-consent/0.1/consent-ui.js index c8bbe2446542..cac21db7e218 100644 --- a/extensions/amp-consent/0.1/consent-ui.js +++ b/extensions/amp-consent/0.1/consent-ui.js @@ -472,6 +472,7 @@ export class ConsentUI { createPromptIframe_(promptUISrc) { const iframe = this.parent_.ownerDocument.createElement('iframe'); const sandbox = this.getSandboxAttribute_(promptUISrc); + iframe.setAttribute('title', this.parent_.title || 'Consent Banner'); iframe.setAttribute('sandbox', sandbox); iframe.setAttribute('allow', IFRAME_ALLOWED_PERMISSIONS.join('; ')); const {classList} = iframe;