Remove label-click-implies-input-click as this behavior is handled by DOM libs #1208
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There's this common UA behavior where clicking on a label which controls an input behaves the same way as a click on the input. As far as I can tell this isn't part of any standard, but it's pretty much universal among browsers in practice. There is some code here in user-event to simulate this behavior, however jsdom and happy-dom both implement this.
In the case of happy-dom this causes a bug producing double-clicks on elements when their controlling label is clicked: capricorn86/happy-dom#1410 . This doesn't affect jsdom because the way it handles
preventDefault
is different, but that's purely an implementation detail that we shouldn't be relying on here.This MR removes the logic to attempt to click controlled inputs when their controlling labels are clicked and leaves it to the DOM lib. In so doing, to prevent interfering with the dom lib's handling of this behavior, this PR also removes the logic to half-way preventing default when user-event has some additional behavior to apply on top of dispatching an event (e.g. in the case of click or clipboard events). It seems to have only really been needed for the label-click scenario. If we find this is necessary, we can let the individual behavior handlers make their own determination about preventing default or not.
Checklist: