-
Notifications
You must be signed in to change notification settings - Fork 127
Note: check e.relatedTarget before setting editing: false #2894
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
base: main
Are you sure you want to change the base?
Note: check e.relatedTarget before setting editing: false #2894
Conversation
@raineorshine Can you please test this branch to see if it resolves #2840 as well as #2841? It's not too terribly likely that the two are directly related, but I have difficulty reproducing #2840 and it would be good to know. |
Let me know if you still need me to test this against both issues, since we clarified the steps to reproduce. |
That's OK, I verified that this does not fix #2840. |
I copied over the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Beautiful, thanks!
@@ -272,4 +274,22 @@ describe('mobile only', () => { | |||
const focusNode = await getSelection().focusNode | |||
expect(focusNode).toBeUndefined() | |||
}) | |||
|
|||
describe('when caret moves from inside a note', () => { | |||
it('cursorForward should move the cursor to the next thought', async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test confirmed ✓
Fixes #2841
The
editing({ value: false })
action was being dispatched when focus was moved from the note to the thought. I think it must be possible forselection.isActive()
to be falseonBlur
beforeonFocus
runs on the thought that is getting selected.More testing is required to verify this assertion a little better, and also to ensure that
e.relatedTarget
is an acceptable substitute forselection.isActive()
. There are some events that may fire with a value ine.relatedTarget
such as opening the hamburger menu, but basic testing indicates that this works OK.