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

[ZD-2703623] deleting space after @mention cursor jump #7

Conversation

cubeguerrero
Copy link

@cubeguerrero cubeguerrero commented Jul 20, 2018

Context

This pull request fixes the cursor jumping problem when using @mention inside the content editor in zendesk_console. Whenever we use emoji and the mention functionality, the At.j library inserts a span with the attribute contenteditable=false while our content editor (see .zendesk-editor--rich-text-comment) has the attribute contenteditable=true. Right now, this kind of nesting is buggy and will cause weird behavior.

cc @zendesk/sustaining @zendesk/harrier

Please see these PR's for reference:
Pull request that introduced the bug:
ichord#423

Pull requests looking to reverse or have already been reversed:
ichord#463
CenterForOpenScience#3

Description

Zendesk Support Ticket 2703623

Steps to reproduce:

  1. Login a user with admin access.
  2. Go to /agent/tickets/<ticket-number>
  3. Try mentioning someone in either the public reply or internal note.
  4. After choosing a person to mention, press backspace and the cursor will jump to the end of the wysiwyg editor.

Before

Google Chrome
chrome-zd2703623-before

Safari
safari-zd2703623-before

After

Google Chrome
chrome-zd2703623

Safari
safari-zd2703623

Todo

  • Create new release tag.
  • Create PR in zendesk_console to update the package.json

Risks

Low: the change just removes an attribute in html which the library doesn't use and adds \u200D as hack for the cursor positioning.

@bmson
Copy link

bmson commented Jul 23, 2018

@zendesk/orchid

Copy link

@gregziegan gregziegan left a comment

Choose a reason for hiding this comment

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

let's try this out and rollback if it causes a worse editing bug 👍

@cubeguerrero cubeguerrero merged commit 3dc758f into master Jul 24, 2018
@cubeguerrero cubeguerrero deleted the cubeguerero/ZD2703623-deleting_space_after_@mention_cursor_jump branch July 24, 2018 00:58
albertldlan added a commit that referenced this pull request Nov 28, 2018
In `at.js` the zero width joiner unicode character (\u200D) is inserted after an
at-mention is inserted into the rich text editor (for our use case, the
at-mention is a condition placeholder). This zwj character causes problems with
the cursor - additionally, the use case for the zwj character is very specific
and in its current form does not do anything. By switching to a zero width space
character we can preserve the spirit of the original implementation and fix the
cursor issue.

This was tested on Google Chrome, Firefox, and Safari. The zwj character was
added to `at.js` in this PR: #7 - it's
important to make sure we are not introducing any regressions with this change.
@albertldlan albertldlan mentioned this pull request Nov 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants