Skip to content

[Bug]: Arrowing onto a /command, @file or #12 in a composer draft opens its suggestion list, which then takes the arrow keys and Enter #36487

Open

Description

@akj

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

apps/web

Steps to reproduce

  1. Open a thread in the web client and focus the composer.
  2. Type /mod ab. The command list opens while /mod is typed and closes at the space.
  3. Press ArrowLeft three times, so the caret sits right after /mod.
  4. Press ArrowDown, then type !.
  5. Clear the draft, repeat steps 2 and 3, then press Shift+Enter.

Expected behavior

The list stays closed after step 3, because nothing in /mod was edited. ArrowDown moves the caret, so the draft reads /mod ab!. Shift+Enter adds a new line after /mod.

Actual behavior

At step 3 the command list opens again, and the editor's aria-activedescendant points at its first option. The open list then takes ArrowUp, ArrowDown, Enter and Tab from the text:

  • Step 4: ArrowDown goes to the list, the caret stays put, and the draft reads /mod! ab.
  • Step 5: Shift+Enter picks the highlighted command. /mod is removed from the draft, leaving ab.

So arrowing through a message that is already written can end in a list nobody asked for, and Enter can replace a word with the highlighted suggestion instead of adding a line or sending.

It is worse with a screen reader. Since #10154 the open list sets aria-activedescendant on the editor, so each time the caret crosses one of these words the list is announced and the reading position in the text is lost.

The same code handles $skill, @file and #12. I confirmed those in a unit test of the trigger logic and by reading the code, not in the app.

Cause. The editor reports caret moves and edits through the same change callback, and the composer looks for a trigger at the caret on every call. The key handler then treats any trigger at the caret as an open menu.

A fix is proposed in #36142.

Impact

Minor bug or occasional failure

Version or commit

main @ 4aec277

Environment

Windows 11, headless Chromium through Playwright 1.64.1, web client from vp run dev. The desktop app wraps the same composer and was not tested. Mobile is not affected: its suggestion popover takes no keys. Screen reader speech on main was not recorded.

Logs or stack traces

No response

Screenshots, recordings, or supporting files

The composer after step 3 with /model ab as the draft: the command list is open although the caret was only moved.

The command list is open above the composer although the caret was only moved onto /model

Workaround

Press Escape when the list opens. It stays closed while the caret is in that word.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions