Skip to content

Slash commands (/) don’t trigger command palette on mobile (keydown not firing) #5928

@MaxVhanamane

Description

@MaxVhanamane

Description
I’m opening a command palette when the user types "/".
This works perfectly on desktop browsers (Windows) , but on mobile browsers ( Android Chrome), the command palette never opens, even though the slash character appears in the editor. what is wrong? is keydown event not firing in android browser?

Here is my code:

 const onKeyDown = (event: React.KeyboardEvent<HTMLDivElement>) => {
   if (
      event.key === "/" &&
      !isInsideCodeBlock(editor) &&
      !showCommandPalette
    ) {
      openCommandPalette();
      return;
    }
}
  <Editable
          renderElement={renderElement}
          decorate={decorate}
          renderLeaf={renderLeaf}
          onDOMBeforeInput={handleRemovePlaceholderText}
          onKeyDown={onKeyDown}
          scrollSelectionIntoView={handleScrollSelectionIntoView}
          className="focus-visible:outline-none flex-1 [&>*]:py-[3px] py-4 [&>*:nth-child(2)]:mt-1 break-words break-all whitespace-pre-wrap"
        />

Recording

slash.commands.mp4

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions