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 submits on ESC. #362

Open
zArubaru opened this issue Apr 28, 2022 · 2 comments · May be fixed by #369
Open

Autocomplete submits on ESC. #362

zArubaru opened this issue Apr 28, 2022 · 2 comments · May be fixed by #369

Comments

@zArubaru
Copy link

zArubaru commented Apr 28, 2022

On the latest versions 2.4.2 pressing escape returns the first choice when using the autocomplete type.

Example code:

import prompts from 'prompts';

(async () => {
  const response = await prompts(
    {
      type: 'autocomplete',
      name: 'value',
      message: 'Please press ESC:',
      choices: [
        {
          title: 'Please',
        },
        {
          title: 'press',
        },
        {
          title: 'ESC',
        },
      ],
    },
    {
      onSubmit: () => {
        console.log('Submitted.');
      },
      onCancel: () => {
        console.log('Cancelled.');
      },
    }
  );

  console.log('Response:', response);
})();

Returns (with a yellow ✖):

✖ Please press ESC: › Please
### Pressing ESC ###
Submitted.
Response: { value: 'Please' }
@iamyoki
Copy link

iamyoki commented Aug 4, 2022

Me too

@zArubaru zArubaru linked a pull request Sep 9, 2022 that will close this issue
@talesmgodois
Copy link

It's happening to me as well

TakshPSingh added a commit to withgraphite/prompts that referenced this issue Feb 5, 2024
this is an open issue in the library: terkelg#362

here's a fix for this that someone made a while ago (which has not been merged for some reason): terkelg#369

This PR makes the same fix in our internal fork
TakshPSingh added a commit to withgraphite/prompts that referenced this issue Feb 5, 2024
this is an open issue in the library: terkelg#362

here's a fix for this that someone made a while ago (which has not been merged for some reason): terkelg#369

This PR makes the same fix in our internal fork
TakshPSingh added a commit to withgraphite/prompts that referenced this issue Feb 5, 2024
this is an open issue in the library: terkelg#362

here's a fix for this that someone made a while ago (which has not been merged for some reason): terkelg#369

This PR makes the same fix to our fork
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants