Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regression from 13.6.2 to 13.7.0: clicking a checkbox no longer fires a change event #1397

Closed
cyyynthia opened this issue Apr 8, 2024 · 3 comments · Fixed by #1435
Closed
Labels
bug Something isn't working

Comments

@cyyynthia
Copy link

cyyynthia commented Apr 8, 2024

Describe the bug
When triggering a click event on an HTMLInputElement, the change event is no longer fired in version 13.7.0 and up. Seems to affect all versions up to latest.

To Reproduce
Steps to reproduce the behavior:

  1. Get an HTMLInputElement with an event listener attached to the change event
  2. Trigger a click (using .dispatchEvent(new MouseEvent('click'))
  3. Observe that the event listener hasn't been fired

Expected behavior
The click and change events should both be fired.

Device:

  • OS: Windows, Linux
  • Browser: Node
  • Version: 13.7.0 and up
@cyyynthia cyyynthia added the bug Something isn't working label Apr 8, 2024
@cyyynthia
Copy link
Author

After a bit more testing; it seems the tooling I'm using does dispatch a new MouseEvent('click'), which does not extend PointerEvent causing the instanceof checks to fail. Hope this helps!

@dbritto-dev
Copy link

@capricorn86 👆🏼

capricorn86 added a commit that referenced this issue May 13, 2024
…nd HTMLLabelElement should check for if a dispatched click event is of type MouseEvent and not PointerEvent which the check previously checked for
capricorn86 added a commit that referenced this issue May 13, 2024
…o-1370-clicking-a-checkbox-no-longer-fires-a-change-event

fix: [#1397] HTMLAnchorElement, HTMLButtonElement, HTMLInputElement a…
@capricorn86
Copy link
Owner

Thank you for reporting @cyyynthia and @dbritto-dev! 🙂

There is a fix in now:
https://github.com/capricorn86/happy-dom/releases/tag/v14.10.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants