Skip to content

[Bug] autocomplete disabled options should not be selectable #464

@pmdpaula

Description

@pmdpaula

Environment

  • OS: Windows
  • Node Version: v24.10.0
  • Package: @clack/prompts
  • Package Version: 1.0.0

Describe the bug
In the autocomplete prompt the disabled options are working.

To Reproduce
That is part of my code.

const autocompletePrompt = await autocomplete({
          message: "procure um servidor para conectar",
          options: servers.map((s) => {
            let hint = `${s.username}@${s.host}${s.description ? ` - ${s.description}` : ""}`;
            let label = `${s.name} [${s.isProduction ? "PRD" : "NPD"}] `;

            if (s.isSegura) {
              label += `SEGURA`;
              hint = `${psshConfig.netUser}[${s.username}@${s.host}]@${psshConfig.seguraHost}.${psshConfig.netDomain}`;
            }

            if (s.username) {
              label += ` <${s.username}>`;
            }

            if (s.databases && s.databases.length > 0) {
              hint = "";

              s.databases.forEach((db, index) => {
                if (index > 0) {
                  hint += ", ";
                }
                hint += `${db}`;
              });
            }

            console.log(
              "🚀 ~ main ~ s.isSegura && !s.username:",
              s.host + " " + (s.isSegura && !s.username),
            );
            return {
              value: s.name,
              label: label,
              hint: hint,
              disabled: true,
            };
          }),
          placeholder: "Digite o nome do servidor para conectar",
          maxItems: 10,
        });

So I tried to force all options to be disabled but they all are enabled.

Expected behavior
I think I shoudn't select disabled options

Additional Information

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Status

    Needs triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions