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.

Reaction to pointer events of children contained in interactive containers

See original GitHub issue
  • Before opening an issue, I checked if a similar issue exists by searching existing issues.

I report that I have discovered a change in the behavior of interactive containers.

Expected Behavior

Display Objects that are interactive will respond to pointer events regardless of the parent container settings.

Current Behavior

Display Objects may not respond to pointer events if the parent container is interactive.

Steps to Reproduce

  • Create interactive containers
  • Create a rectangle 1 with interactive = false on the front.
  • Create a rectangle 2 with interactive = true on the back.
  • Add rectangles 1 and 2 to the interactive container.

When I click on the overlapping area of rectangles 1 and 2, rectangle 2 responds in v6.5.7, but not in v7.0.4.

Here is the code for reproduction. jsfiddle v6.5.7 jsfiddle v7.0.4 Open the console and check the pointer event listener.

Question

Is this change a planned change in EventSystem? Or is it an unintended bug?

If it is a planned change, I would be happy to leave this issue as a record for users to understand. If this is an unintended bug, I’d be happy to help you resolve it.

Environment

  • pixi.js version: v6.5.7 and v7.0.4
  • Browser & Version: Chrome 107.0.5304.121
  • OS & Version: macOS 12.6.1

Issue Analytics

  • State:open
  • Created 10 months ago
  • Reactions:1
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
bigtimebuddycommented, Dec 19, 2022

This is an intentional change in PixiJS to bring the interaction behavior more consistent with the DOM.

Here’s the same example with DOM elements:

https://jsfiddle.net/bigtimebuddy/k08xsfdt/

0reactions
MasatoMakinocommented, Dec 19, 2022

This behavior occurs only when there is a Container with interactive = true. So, if a box added directly to a stage, it will behave differently.

https://jsfiddle.net/MasatoMakino/f6mc1gtd/2/ In this case, the behavior is the same as in Pixi.js v6.5.7.

Read more comments on GitHub >

github_iconTop Results From Across the Web

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 >
React how to prevent a parent's onclick event from firing when ...
Try using pointer-events. Example: HTML - <div className={classes.container} onClick={() => navigate(`${props.
Read more >
Interaction - PixiJS
PixiJS supports three types of interaction events - mouse, touch and pointer. Mouse events are fired by mouse movement, clicks etc. Touch events...
Read more >
Pointer Events - W3C
Pointer Events provide all the usual properties present in Mouse Events (client coordinates, target element, button states, etc.) in addition ...
Read more >
pointer-events | CSS-Tricks
The pointer-events property allows for control over how HTML elements respond to mouse/touch events – including CSS hover/active states, ...
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