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

[Bug] multiselect only shows the hint on the first item in the options #196

Open
skoblenick opened this issue Jun 7, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@skoblenick
Copy link

Environment

  • OS: Ubuntu 22.04.4
  • Node Version: 22.2.0
  • Package: @clack/prompts
  • Package Version: 0.7.0

Describe the bug

The multiselect only shows the hint on the first item in the options, as shown below:

  1. scenario 1:
◆  Select additional tools.
│  ◼ Prettier (recommended)
│  ◼ ESLint
│  ◻ Stylelint
│  ◻ GitHub Action
└
  1. scenario 2:
◆  Select additional tools.
│  ◻ Prettier
│  ◼  ESLint
│  ◻ Stylelint
│  ◼ GitHub Action
└

To Reproduce

Basically taken from your examples in this repo; see https://stackblitz.com/edit/node-kwuxhe

Steps to reproduce the behavior:

  1. run npm init -y
  2. run npm install @clack/prompts --save
  3. add "type": "module" to the package.json
  4. use the code:
    #!/usr/bin/env node
    
    import * as p from '@clack/prompts';
    
    async function main() {
      const project = await p.group({
        scenario1: () =>
          p.multiselect({
            message: 'Scenario 1.',
            initialValues: ['prettier', 'eslint'],
            options: [
              { value: 'prettier', label: 'Prettier', hint: 'recommended' },
              { value: 'eslint', label: 'ESLint', hint: 'recommended' },
              { value: 'stylelint', label: 'Stylelint' },
              { value: 'gh-action', label: 'GitHub Action' },
            ],
          }),
        scenario2: () =>
          p.multiselect({
            message: 'Scenario 2',
            initialValues: ['eslint', 'gh-action'],
            options: [
              { value: 'prettier', label: 'Prettier' },
              { value: 'eslint', label: 'ESLint', hint: 'recommended' },
              { value: 'stylelint', label: 'Stylelint' },
              { value: 'gh-action', label: 'GitHub Action', hint: 'recommended' },
            ],
          }),
      });
    }
    
    main().catch(console.log);
  5. run the code with node ./index.js

Expected behavior

I would expect the output from the prompt to be:

◆  Scenario 1.
│  ◼ Prettier (recommended)
│  ◼ ESLint (recommended)
│  ◻ Stylelint
│  ◻ GitHub Action
└
◆  Scenario 2.
│  ◻ Prettier
│  ◼ ESLint (recommended)
│  ◻ Stylelint
│  ◼ GitHub Action (recommended)
└
@skoblenick skoblenick added the bug Something isn't working label Jun 7, 2024
@github-project-automation github-project-automation bot moved this to Needs triage in Triage Board Dec 29, 2024
@natemoo-re
Copy link
Member

Hey, thanks for opening an issue! I'm finally working through the backlog here.

Seems like this should be a simple enough bug fix, I'll try to get a fix into the next patch or minor release.

@natemoo-re natemoo-re moved this from Needs triage to On deck in Triage Board Jan 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: On deck
Development

No branches or pull requests

2 participants