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

Rich Text: Detect handled horizontal navigation by preventDefault #7644

Merged
merged 1 commit into from Jul 2, 2018

Conversation

Projects
None yet
2 participants
@aduth
Member

aduth commented Jun 29, 2018

Related: #6712

This pull request seeks to improve upon the implementation of horizontal navigation in RichText from #6712. Per observation in #6712 (comment) , it finds a workaround to TinyMCE's calling of preventDefault on an unhandled caret movement by reassigning its internal event's preventDefault to a noop when the arrow key is moving away from the inline boundary (not within it). This allows WritingFlow to detect the key press as being handled via the standard Event#defaultPrevented, rather than knowledge of an internal _navigationHandled property.

Further, it avoids binding a keydown event to the entire document, which as noted in #6712 (comment) could be problematic.

The revised implementation also seems to correct a potentially wrong behavior where collapsing a selection was wrongly causing the selection to be moved to a previous / next paragraph. This is reflected in updated end-to-end test with explaining comment.

Testing instructions:

Verify that you can traverse into and out of inline boundaries, including those which occur at the beginning or end of a paragraph.

Ensure end-to-end tests pass:

./bin/run-e2e-tests.sh

@aduth aduth requested a review from tofumatt Jun 29, 2018

@tofumatt

This is so much nicer! The code is easier to understand. Everything still works great for me.

I noticed the splitting of bold text with return seems to work better too–it moved focus to the correct paragraph.

I can't run the e2e tests right now and feel bad blocking this on that.

@aduth

This comment has been minimized.

Member

aduth commented Jul 2, 2018

I noticed the splitting of bold text with return seems to work better too–it moved focus to the correct paragraph.

Nice incidental win 😄 Same issue was also intended to be improved with #7620 .

@aduth aduth merged commit 66f2d2a into master Jul 2, 2018

2 checks passed

codecov/project 46.99% (+0.01%) compared to 51c6ca7
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@aduth aduth deleted the fix/inline-boundary-zwsp branch Jul 2, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment