cferdinandi / cferdinandi/events

Non-bubbling events won't trigger, but are accepted.

Open
#7 2 comments 4 reactions 0 assignees View on GitHub
bug
Dominant language
JavaScript
Stars
61
Forks
13
PR merge metrics
No merged PRs in 30d

Description

**Test case:** https://codepen.io/hlsiira/pen/mdeyvVN

Hey, I think I have come across a weird edge case that I can't quite nail down the issue.

When using Events, some event types don't bubble to the window, like MouseLeave, or MouseEnter, which means they are never triggered using Events. In trying to fix the issue, I tried to write a function to test whether or not an event type would bubble or not, and if it doesn't, add the listener directly to the element instead of to the window.

However, in trying to fix the issue, I noticed that MouseLeave seems to bubble in Firefox, but not in Chrome; more like in Firefox, MouseLeave acts like MouseOut.

Originally I figured it was just a simple case of detecting if the event type bubbles or not, but due to the weird Firefox VS Chrome handling, I'm not really sure if that is the actual issue, or if it's something else.

Thanks for making an awesome helper library, it's made coding way easier!

Contributor guide

Open the contributing guide

Research direction

Start with the CodePen test case and reproduce the MouseLeave and MouseEnter behavior in Chrome and Firefox. Read the event delegation entry point used by Events, then determine how non-bubbling events should be handled across browsers. Done means the affected event types trigger on their intended elements consistently.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.