Skip to content

♻️[amp story page advancement] handle clicks on drawer#36715

Merged
processprocess merged 1 commit intoampproject:mainfrom
processprocess:drawer-clicks
Nov 2, 2021
Merged

♻️[amp story page advancement] handle clicks on drawer#36715
processprocess merged 1 commit intoampproject:mainfrom
processprocess:drawer-clicks

Conversation

@processprocess
Copy link
Copy Markdown
Contributor

This simplifies the handle event check when a click is inside a draggable drawer.

This checks if the element is a draggable drawer rather than checking the tag name of elements that extend the draggable drawer.

This will be helpful in the future - when other elements extend draggable drawer (such as amp-story-shopping-attachment), we will not need to add another tag to this list.

@amp-owners-bot
Copy link
Copy Markdown

amp-owners-bot bot commented Nov 2, 2021

Hey @gmajoulet, @newmuis! These files were changed:

extensions/amp-story/1.0/page-advancement.js

tagName === 'amp-story-page-attachment' ||
tagName === 'amp-story-page-outlink'
) {
if (el.classList.contains('amp-story-draggable-drawer-root')) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to revert, I'm just trying to offer an alternative argument to consider next times we want to do such optimizations.
The previous implementation had the advantage of being much easier to understand for people with 0 context, making the codebase a bit more accessible. It used to read as "content within page-attachment or page-outlink don't trigger page advancement". Now with this class it's a bit less obvious.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree that this needs a comment. Opened #36764

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants