Skip to content

autocompleteMultiselect: contextual ESC to clear filter before cancelling #519

@nsxdavid

Description

@nsxdavid

Hey, small UX suggestion for autocompleteMultiselect (and autocomplete).

When you've typed a long filter string and want to clear it, the only option right now is holding backspace until it's gone. Pressing ESC bails out of the prompt entirely, which loses the work in progress (any tab-toggled selections, etc).

Could ESC be made contextual? Something like:

  • If the filter input has text → clear it
  • If the filter input is already empty → cancel (current behavior)

This is what fzf does, and it's also how browser address bars and most "type-ahead" UIs handle it — a single ESC tap to clear is intuitive and saves you from holding backspace through a 30-character query you no longer want.

Backspace-per-char is fine for short stuff but starts to grate when you're refining filters across a long list. In my use case I'm pruning 150 git branches via autocompleteMultiselect, and being able to filter, tab a few items, clear, filter again would feel a lot more natural than holding backspace each time.

Happy to look at a PR if it's a direction you're open to. Mostly wanted to surface the suggestion first since changing ESC semantics could surprise people who rely on the current behavior.

Versions: @clack/prompts@1.2.0 / @clack/core@latest

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Needs triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions