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

feat(keyboard): move cursor and delete content in contenteditable #822

Merged
merged 4 commits into from
Jan 1, 2022

Conversation

ph-fritsche
Copy link
Member

@ph-fritsche ph-fritsche commented Jan 1, 2022

What:

Support cursor movement and editing contenteditable from collapsed selection range a.k.a. a simple cursor when the movement/edit is outside of an already focused TextNode.

Why:
Closes #806

How:

Calculate the next cursor position as observed in the browser.
Use Range API to manipulate the DOM.

Checklist:

  • Tests
  • Ready to be merged

@ph-fritsche ph-fritsche added this to the userEvent v14 milestone Jan 1, 2022
@codesandbox-ci
Copy link

codesandbox-ci bot commented Jan 1, 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 c408bcd:

Sandbox Source
userEvent-PR-template Configuration

@codecov
Copy link

codecov bot commented Jan 1, 2022

Codecov Report

Merging #822 (c408bcd) into beta (4f56856) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##              beta      #822    +/-   ##
==========================================
  Coverage   100.00%   100.00%            
==========================================
  Files           79        80     +1     
  Lines         1578      1679   +101     
  Branches       559       610    +51     
==========================================
+ Hits          1578      1679   +101     
Impacted Files Coverage Δ
src/keyboard/plugins/arrow.ts 100.00% <100.00%> (ø)
src/utils/edit/prepareInput.ts 100.00% <100.00%> (ø)
src/utils/focus/cursor.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 4f56856...c408bcd. Read the comment docs.

@ph-fritsche ph-fritsche changed the title determine next cursor position feat(keyboard): move cursor and delete content in contenteditable Jan 1, 2022
@ph-fritsche ph-fritsche merged commit b83b259 into beta Jan 1, 2022
@ph-fritsche ph-fritsche deleted the fix-806 branch January 1, 2022 19:59
@github-actions
Copy link

github-actions bot commented Jan 1, 2022

🎉 This PR is included in version 14.0.0-beta.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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Delete elements in contenteditable per contentDeleteBackward and contentDeleteForward
1 participant