New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
馃悰 [Story clicks] Make grid layer content not click shield other elements #38377
Merged
Merged
Changes from 2 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
787c4f5
Made grid layer content not click shield other elements
mszylkowski 4a8e731
Update extensions/amp-story/1.0/amp-story.css
mszylkowski 747f708
Added example of unclickable div on top of quiz
mszylkowski 2ac53f0
Merge branch 'ampproject:main' into no_click_shield
mszylkowski e080153
Merge branch 'ampproject:main' into no_click_shield
mszylkowski File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would reset all publisher CSS incorrectly setting pointer-events, removing it is pretty risky and impossible to test :(
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is only 2 values of pointer-events:
auto
andnone
. If they manually set it toauto
, they receive the same behavior as is currently happening (noop). If they manually set it tonone
the clickable elements will override that property and catch clicks as expected (improvement if added to foreground layers that are "covering" clickable elements).I don't believe there's a scenario where pubs can incorrectly set the pointer events to break the story. The system layer is a separate layer not in the
grid-layer
so it doesn't get affected, and all clickable elements override thepointer-events: auto
so they can be clickedThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This solution does not scale well and is so easy to break. Each developer needs to set its own pointer-events if they want to receive clicks?
You forgot some, introducing bugs already: e.g.
i-amphtml-story-page-play-button
and maybe some others that we're forgetting aboutThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another example: people using
button
elements to trigger flows, e.g. consent for CCPA implementationsThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i-amphtml-story-page-play-button
is not added to the inside of a grid-layer, therefore is not affected by this at all. Only the elements inside grid-layers are affected (look at the CSS selectors). Amp consent is on a button outside the grid-layer so doesn't get affected. User-created buttons are not allowed inside grid-layers. You should only look at the valid list of components under "amp-story-grid-layer-allowed-descendants".The reason why this doesn't scale is because we (AMP devs) take the burden of making it work, instead of relying on creation tools to add the right values. We do the same for many things, and if someone sends a bug we can just fix it (eg: someone says X component is not clickable -> we make a PR with the CSS rule). "Developer Experience > Ease of Implementation". The alternatives are worse for DevX or UX:
What alternative would you suggest that doesn't put the burden on the creator and scales better?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For user using buttons, doesn't amp convert them to a tags ? If not, why not just add button to the css rule ?
The amp framework is restraining enough, we should be able to list exhaustively every possible interactions isn't it ? That way the framework would also prevent not interactive layer to prevent you from clicking, I don't see how this could be a regression as long as the list is exhaustive and tested on every possible interactive amp components.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not aware of any buttons that users can add onto stories, the
button
tag is specifically not allowed in stories. What you refer is links (<a>
tags) which we replace the functionality so they are always clickable with the changeamp-story-grid-layer a {pointer-events: auto}
in this PR.Edit: I do agree that we could exhaustively list all the clickable elements in amp-story-grid-layer, which is what I'm doing in this PR :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
up
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Up again, this is still a very big issue for us.