Skip to content

Commit

Permalink
Prevent double navigation from page-outlink. (#35187)
Browse files Browse the repository at this point in the history
  • Loading branch information
gmajoulet committed Jul 12, 2021
1 parent 9ec218b commit 2418d20
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions extensions/amp-story/1.0/amp-story-page-attachment.js
Original file line number Diff line number Diff line change
Expand Up @@ -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') {
Expand Down

0 comments on commit 2418d20

Please sign in to comment.