From 2418d20bba15f01a2418691909bc1aac9f99dd8a Mon Sep 17 00:00:00 2001 From: Gabriel Majoulet Date: Mon, 12 Jul 2021 16:49:20 -0400 Subject: [PATCH] Prevent double navigation from page-outlink. (#35187) --- extensions/amp-story/1.0/amp-story-page-attachment.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/extensions/amp-story/1.0/amp-story-page-attachment.js b/extensions/amp-story/1.0/amp-story-page-attachment.js index 3a82c903403b..ad5774e2d921 100644 --- a/extensions/amp-story/1.0/amp-story-page-attachment.js +++ b/extensions/amp-story/1.0/amp-story-page-attachment.js @@ -276,6 +276,11 @@ export class AmpStoryPageAttachment extends DraggableDrawer { link.setAttribute('href', hrefAttr); const {openStringEl, urlStringEl} = htmlRefs(link); + // Navigation is handled programmatically. Disable clicks on the placeholder + // anchor to prevent from users triggering double navigations, which has + // side effects in native contexts opening webviews/CCTs. + link.addEventListener('click', (event) => event.preventDefault()); + // Set image. const openImgAttr = this.element.getAttribute('cta-image'); if (openImgAttr && openImgAttr !== 'none') {