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

Autocomplete: Cursor position lost when clicking to insert item #50168

Open
sandymcfadden opened this issue Apr 28, 2023 · 2 comments
Open

Autocomplete: Cursor position lost when clicking to insert item #50168

sandymcfadden opened this issue Apr 28, 2023 · 2 comments
Labels
[Feature] Inserter The main way to insert blocks using the + button in the editing interface [Feature] Rich Text Related to the Rich Text component that allows developers to render a contenteditable Needs Technical Feedback Needs testing from a developer perspective. [Type] Bug An existing feature does not function as intended

Comments

@sandymcfadden
Copy link

Description

Using a custom autocompleter the cursor position is sometimes lost when inserting an item.
If you use your mouse to click on an autocomplete item, the item inserts as expected, but the cursor position is lost and you can't continue typing until you click back into the block.
If you use keyboard controls to insert the item instead, the cursor position is kept as expected.

Step-by-step reproduction instructions

Tried to narrow down to a basic example it can be found here
https://codesandbox.io/p/sandbox/amazing-kilby-pl9v09

  1. Go to https://pl9v09-3000.csb.app/
  2. Click to type in the paragraph block
  3. Type the # character to bring up the autocompleter
  4. Use your mouse to click on one of the items
  5. Notice the cursor is not positioned at the end of the inserted item as expected

Screenshots, screen recording, code snippet

Example code can be found here
https://codesandbox.io/p/sandbox/amazing-kilby-pl9v09

Environment info

No response

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

@kathrynwp kathrynwp added Needs Testing Needs further testing to be confirmed. [Type] Bug An existing feature does not function as intended [Feature] Inserter The main way to insert blocks using the + button in the editing interface labels May 1, 2023
@Mamaduka
Copy link
Member

Mamaduka commented May 2, 2023

Thanks for contributing, @sandymcfadden, and providing an excellent reproduction example.

I can also reproduce the behavior using default autocompleters.

@ellatrix, can you confirm if this is an intentional behavior?

@Mamaduka Mamaduka added [Feature] Rich Text Related to the Rich Text component that allows developers to render a contenteditable Needs Technical Feedback Needs testing from a developer perspective. and removed Needs Testing Needs further testing to be confirmed. labels May 2, 2023
@ellatrix
Copy link
Member

I can reproduce with the @ mention autocompleter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Inserter The main way to insert blocks using the + button in the editing interface [Feature] Rich Text Related to the Rich Text component that allows developers to render a contenteditable Needs Technical Feedback Needs testing from a developer perspective. [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

No branches or pull requests

4 participants