Skip to content

User mention suggestions can't be exited from within a list block #43063

@chad1008

Description

@chad1008

Description

When adding a user mention within a list block pressing enter multiple times does not successfully exit the autocompleter and in turn the list block itself.

Effectively, a user can find themselves trapped in a list block after inserting a user mention, unless they forcibly exit the autocomplete.

There are actually two symptoms here, which appear to have been introduced separately:

  1. Getting trapped inside the autocomplete and by extension, the list block. This appears to have been present since at least v12.7.0. I didn't have bandwidth to try tracing it further back than that.
  2. The second, seemingly newer, issue is that after selecting a user mention and starting a new list item, the user mention suggestions appear in the upper left hand corner of the screen rather than at the cursor. This appears to have been introduced as part of the Popover components floatinUI refactor (cc @ciampo, I know you've been doing some work in that area recently)

Ordinarily I'd view these as two separate bugs, but the second one only happens after the initial completion, when the autocomplete persists after a selection. If that weren't happening, it doesn't look like we'd have the second issue without the first.

Step-by-step reproduction instructions

  1. create a new post
  2. type - test to open a list block
  3. press enter to create a new list element
  4. type test 2 @a to trigger a user mention (change the trigger text as needed to match a user on your test site)
  5. press enter once to select a username
  6. press enter a second time to create a new list element
  7. notice the user mention suggestions persist, but relocate to the upper left corner of the viewport
  8. press enter a third time to escape the list block
  9. notice that rather than escaping the block, your user mention is re-selected, taking you back to the previous list entry
  10. continue pressing enter. You're now caught in a loop of creating a new line, and re-selecting your mention, then repeating
  11. abandon the enter key, it has forsaken you
  12. press escape to close the completer. Now you can use enter again to escape the list block

Note: if the first user mention inside the list block doesn't trigger the above behavior, try entering another one on the second list item. In my testing there were rare occasions where the bug wouldn't manifest until the second or third user mention.

Screenshots, screen recording, code snippet

No response

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    [Block] ListAffects the List Block[Type] BugAn existing feature does not function as intended

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions