Skip to content

fix: fire lowercase event types for Preact 11 - #86

Merged
JoviDeCroock merged 2 commits into
mainfrom
fix/preact-11-event-casing
Oct 22, 2026
Merged

JoviDeCroock merged 2 commits into
mainfrom
fix/preact-11-event-casing

Conversation

@JoviDeCroock

@JoviDeCroock JoviDeCroock commented Oct 22, 2026 •

Copy link
Copy Markdown
Member

Preact 11 always lowercases event names before adding listeners (onTouchStart → touchstart). Preact 10 only did that when the element had a matching on* property, so in jsdom it listened for TouchStart, and fireEvent copied that by dispatching the capitalised type. On Preact 11 that misses the listener for every event jsdom has no on* property for (touch, animation, transition, clipboard, composition, pointerenter/leave, …): 17 tests in events.js fail.

The same mismatch already existed on Preact 10 for:

fireEvent now dispatches the lowercase type in those cases, and probes once whether the installed Preact always lowercases. The suite, including new focusIn/focusOut and compat tests, passes on both 10.29.8 and 11.0.1.

Fixes #67

Investigated and authored with help from Claude (Opus 5.5).

Preact 11 always lowercases event names it listens for, whereas Preact 10
only did so when the element had a matching on* property. Detect which
behavior the installed Preact has so fireEvent hits the listener for
events jsdom has no on* property for (touch, animation, clipboard, ...).
Preact 10 always lowercases onFocusIn/onFocusOut, and preact/compat
lowercases onAnimation*, onTransition*, onTouch*, onBeforeInput and
onComposition* itself, so fireEvent dispatched a capitalised type that
missed the listener in jsdom.

Fixes #67
@JoviDeCroock
JoviDeCroock merged commit 90585d6 into main Oct 22, 2026
3 checks passed
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 3.2.6 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fireEvent.animationEnd does not call preact-registered listener

1 participant