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

fix(click): skip explicit re-dispatch for face #1238

Merged
merged 7 commits into from
Jan 21, 2025

Conversation

hesxenon
Copy link
Contributor

@hesxenon hesxenon commented Nov 6, 2024

What:

closes #1237

Why:

Re-dispatching a click event on the control of a label is already skipped for labeled controls that are builtin. This change also skips form associated custom elements (FACEs) since they are always classified as labelable elements and are thus handled by the user agent already.

How:

Check whether the formAssociated static property exists by reading it from the targets constructor.

Checklist:

  • Tests
  • Ready to be merged

Copy link

codesandbox-ci bot commented Nov 6, 2024

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

@hesxenon
Copy link
Contributor Author

hesxenon commented Nov 6, 2024

there's a bit of a problem with the test setup... jsdom does not yet support FACEs as far as I can see: jsdom/jsdom#3444

So while rudimentary CE tests are possible it seems that e.g. the HTMLLabel implementation does not find the nested FACE :/

Any tips on how to progress here?

@hesxenon
Copy link
Contributor Author

@ph-fritsche would you mind taking a look at this? It's been some time since I fully grokked the behaviour in question and upon updating jsdom to the latest version (in which appropriate tests for this change would even be possible) a few more tests than I was hoping for fail.

@hesxenon hesxenon marked this pull request as ready for review January 19, 2025 16:25
@ph-fritsche
Copy link
Member

@hesxenon I've rebased the commits onto current main and applied some changes on top. What do you think?

@ph-fritsche ph-fritsche merged commit 465fc7e into testing-library:main Jan 21, 2025
3 checks passed
Copy link

🎉 This PR is included in version 14.6.1 🎉

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.

click leads to endless loop for custom elements in label
2 participants