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

DOM: Restore horizontal edge traversal implementation #8461

Merged
merged 2 commits into from
Aug 7, 2018

Conversation

aduth
Copy link
Member

@aduth aduth commented Aug 3, 2018

Related: #8306 (cherry-picks c363a87)
Regression introduced in #7877
Fixes #8388

This pull request seeks to resolve an issue where pressing Backspace may not place the caret in the correct position if within or after a RichText field which includes newlines. This is a flaw of the updated implementation implementation included in #7877 which uses Range#toString and Node#textContent, both of which produce unreliable results when including a br element.

The changes here reintroduce the original implementation authored by @iseulde , with some explanatory comments. It cherry-picks the once-failing test from @pento , originally committed in #7877.

Testing instructions:

Ensure end-to-end tests pass:

npm run test-e2e

Copy link
Contributor

@youknowriad youknowriad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The implementation is not easy to follow but it works great and thanks for the test.

@aduth aduth force-pushed the fix/newline-backspace branch from 159e204 to 48a16ab Compare August 6, 2018 20:37
@aduth aduth merged commit 41ff1f2 into master Aug 7, 2018
@aduth aduth deleted the fix/newline-backspace branch August 7, 2018 00:26
@aduth
Copy link
Member Author

aduth commented Aug 8, 2018

This caused a regression #8731

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Rich Text Related to the Rich Text component that allows developers to render a contenteditable [Package] DOM /packages/dom
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Backspace jumps to previous block instead of going to previous line in same paragraph block
3 participants