Skip to content

Add z-index aware event dispatch#997

Merged
dzhou121 merged 2 commits intomainfrom
z-index-event-handling
Dec 18, 2025
Merged

Add z-index aware event dispatch#997
dzhou121 merged 2 commits intomainfrom
z-index-event-handling

Conversation

@dzhou121
Copy link
Contributor

Implement CSS-like stacking context behavior for pointer events:

  • Events now dispatch to views based on visual z-index order, not DOM order
  • Higher z-index views receive events before lower z-index siblings
  • Stacking contexts are properly bounded (child z-index doesn't escape parent)

Implement CSS-like stacking context behavior for pointer events:
- Events now dispatch to views based on visual z-index order, not DOM order
- Higher z-index views receive events before lower z-index siblings
- Stacking contexts are properly bounded (child z-index doesn't escape parent)
@dzhou121 dzhou121 merged commit eb45358 into main Dec 18, 2025
7 checks passed
@dzhou121 dzhou121 deleted the z-index-event-handling branch December 18, 2025 20:53
@jrmoulton
Copy link
Collaborator

I have some changes that will mostly overwrite this. I have redone the event handling and it is now significantly more robust and respects z index and also has explicit phases for capture, target and bubble. It also does hit testing using a spatial index so no more need to slowly walk the view tree for hit testing. In the changes I have, events are still dispatched in dom order, but the event context caries the visual hit path so an event handler can see/use the visual order if desired

@dzhou121
Copy link
Contributor Author

Do you want to push it and let's take a look?

@jrmoulton
Copy link
Collaborator

draft in #998. The event handling is in src/context/event.rs. needs a bit more work to make propagation work

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants