[Story tooltip] Pointer events don't get triggered if upper grid-layer covers page
See original GitHub issueDescription
Introduced in #18945 there is a CSS rule that should allow clicking on a grid-layer that’s not first in the stack of layers on a page. However, if the foreground layer has anything (eg: a div
) covering the whole page, then it will block the clicks, even if that element should not be clickable. The properties have !important
so they cannot be overriden by publishers.
amp-story-grid-layer {
pointer-events: none !important;
}
amp-story-grid-layer * {
pointer-events: auto !important;
}
<amp-story-grid-layer>
<div class="full-page center-div">
<a href="https://clickonbackgroundlayer.com"><p>Cannot be clicked</p></a>
</div>
</amp-story-grid-layer>
<amp-story-grid-layer layout="fill">
<div style="width:100%;height:100%;position:absolute;left:0;top:0">
<a href="https://clickonforegroundlayer.com"><p>Can be clicked</p></a>
</div>
</amp-story-grid-layer>
Potential fixes
- [Preferred] We can set
pointer-events: auto
to only the elements that are interactive (tooltips, amp-twitter, amp-story-interactive). This will involve removing the ruleamp-story-gid-layer * {pointer-events: auto !important}
but addingpointer-events: auto
on the elements that are supposed to be clickable. - We can make the CSS rule not
!important
so it can be overriden
Issue Analytics
- State:
- Created 2 years ago
- Comments:25 (25 by maintainers)
Top Results From Across the Web
[Tooltip] Use Pointer Events #564 - reach/reach-ui - GitHub
I know this can be done in user land with the useTooltip hook by mapping the mouse events to pointer events, and I'm...
Read more >pointer-events - CSS: Cascading Style Sheets - MDN Web Docs
The pointer-events CSS property sets under what circumstances (if any) a particular graphic element can become the target of pointer events.
Read more >Is there a `pointer-events:hoverOnly` or similar in CSS?
I have a div that I want to be invisible to all mouse events, except for :hover . So all click commands go...
Read more >There's no reason to use pointer-events for HTML elements
The pointer-events CSS property controls if and how elements can be targeted by pointer inputs such as a mouse. It initially formed part...
Read more >Pointer Events - W3C
Event types have been proposed for handling each of these forms of ... of pointer inputs, this model does not cover other forms...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
That is set on
amp-story-grid-layer {pointer-events: none !important}
, I can check if that attribute is not propagatedI’m working on a solution to automatically set the correct pointer-events to the correct values, given the small number of valid elements that are clickable in a grid-layer (they are: interactive components, links, shopping tags, amp-twitter).