question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Story tooltip] Pointer events don't get triggered if upper grid-layer covers page

See original GitHub issue

Description

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 rule amp-story-gid-layer * {pointer-events: auto !important} but adding pointer-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:closed
  • Created 2 years ago
  • Comments:25 (25 by maintainers)

github_iconTop GitHub Comments

1reaction
mszylkowskicommented, Jun 1, 2021

That is set on amp-story-grid-layer {pointer-events: none !important}, I can check if that attribute is not propagated

0reactions
mszylkowskicommented, Jul 29, 2022

I’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).

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found