Skip to content

CMDK is triggering onSelect everytime enter key is pressed. #353

Closed as not planned

Description

@adamborowski

Hi.
I have small request/proposal or just a question.

My use case is to use cmdk "inline" in the dialog which may have additional controls such as select (to filter the cmdk list).
Pressing enter when select is opened already works as you accept the command item which is not expected.

As a workaround, I have to stop keydown propagation so cmdk doesn't get enter key event from select component.

Please use this V0 https://v0.dev/chat/filtered-command-dialog-gPBKS3Y18LB

Simply open the dialog, focus on the select, use keyboard arrows to navigate to some option, and press enter.
It closes the dialog. When you click by mouse, it just filters the commands

The code doesn't have any filtering logic like if the trigger is aria-expanded, or any kind of "foreign" input
https://github.com/pacocoursey/cmdk/blob/fb4ea04e9ec211777fbb39c6104e3c5f2ee107d2/cmdk/src/index.tsx#L625-L639

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