Skip to content

fix(pointer): consider click context#850

Merged
ph-fritsche merged 1 commit intobetafrom
fix-848
Feb 8, 2022
Merged

fix(pointer): consider click context#850
ph-fritsche merged 1 commit intobetafrom
fix-848

Conversation

@ph-fritsche
Copy link
Copy Markdown
Member

@ph-fritsche ph-fritsche commented Feb 8, 2022

What:

Consider the ancestor elements when applying click behavior.

Why:

If a click happens inside a <button>, <input>, <label> or <textarea> element, this changes the default behavior.

Extending the code snippet that focused the associated control of a clicked label to also apply the click on the control
resulted in a loop if the control was nested inside that label.
Closes #848
Closes #849

How:

const context = target.closest('button,input,label,textarea')
const control = context && isElementType(context, 'label') && context.control
if (control) {

Checklist:

  • Tests
  • Ready to be merged

@codesandbox-ci
Copy link
Copy Markdown

codesandbox-ci Bot commented Feb 8, 2022

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.

Latest deployment of this branch, based on commit d3ce526:

Sandbox Source
userEvent-PR-template Configuration

@ph-fritsche ph-fritsche added this to the userEvent v14 milestone Feb 8, 2022
@codecov
Copy link
Copy Markdown

codecov Bot commented Feb 8, 2022

Codecov Report

Merging #850 (d3ce526) into beta (214fd03) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##              beta      #850   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           89        89           
  Lines         1762      1763    +1     
  Branches       622       623    +1     
=========================================
+ Hits          1762      1763    +1     
Impacted Files Coverage Δ
src/event/behavior/click.ts 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 214fd03...d3ce526. Read the comment docs.

@ph-fritsche ph-fritsche merged commit ca4482a into beta Feb 8, 2022
@ph-fritsche ph-fritsche deleted the fix-848 branch February 8, 2022 11:09
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Feb 8, 2022

🎉 This PR is included in version 14.0.0-beta.10 🎉

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Type into text field generate a Maximum call stack size exceeded error Click on a checkbox generate a Maximum call stack size exceeded error

1 participant