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

Unable to select any options in a multi-select prompt on Windows WSL2 #41

Closed
shane-smith opened this issue Aug 6, 2023 · 3 comments · Fixed by #50
Closed

Unable to select any options in a multi-select prompt on Windows WSL2 #41

shane-smith opened this issue Aug 6, 2023 · 3 comments · Fixed by #50

Comments

@shane-smith
Copy link

Laravel Prompts Version

0.1.3

Laravel Version

10.17.1

PHP Version

8.2.8

Operating System & Version

Windows 10 Pro - 22H2

Terminal Application

WSL2 (via VS Code / Windows Terminal)

Description

Hi, I'm unable to select any options with multi-select prompts.

This is my first experience using the new prompts package by running breeze:install on a new verison of Laravel. I want to enable options here (e.g. "Dark mode") but seem unable to do so. I can only submit it with none selected.

image

Windows WSL2, same issue both via VS Code terminal and also directly in Windows Terminal for Ubuntu.

laravel prompts 0.1.3

I have tried several different control and alphanumeric keys on my keyboard, to no effect. I can only navigate up and down between options, but not select them.

In another issue, @jessarcher mentioned this:

Could you try running the following minimal debugging script on the affected command line

This is my result with that script... entering: UP, DOWN, LEFT, RIGHT, h, j, ENTER, Ctrl+C:

"\u001b[A"
"\u001b[B"
"\u001b[D"
"\u001b[C"
"h"
"j"
"\n"
"\u0003"
Restoring TTY

How do I select an option from this list?

Steps To Reproduce

Use any artisan command that uses an optional multi-select list of options, e.g. php artisan breeze:install

@jessarcher
Copy link
Member

Hi @shane-smith,

The space bar is used to toggle the highlighted option, and then the enter key submits them when you're done. Can you let me know if that works for you?

It mimics web browser behaviour and is common in command-line interfaces, but I can understand it not being obvious. Was there another key that felt more intuitive to you?

I've also been thinking about adding a "help text" feature to display information beneath the input, which might help this situation.

@shane-smith
Copy link
Author

shane-smith commented Aug 6, 2023

@jessarcher

That does work! Thank you 😁

Problem solved.

I must have tried everything else I could think of on the keyboard, except space bar.

In hindsight I'm unsure how I missed it. It's the biggest key!

Help text

If I saw help text suggesting that options can be selected using the space bar, it would've saved me at least 45 minutes today.

I was searching for answers on how to submit these with laravel prompts and came up mostly empty. It's possible people will find this issue in the future, see your response, and adding help text won't actually be needed.

Alternatives

For me, the space bar wasn't an expected way to interact with this component.

However I also wasn't sure what it would be. I think my first attempt was with the arrow keys.

Another attempt was with function keys like TAB, CTRL, SHIFT, ALT. After that I tried a bunch of numbers and letters, hoping I'd stumble across the answer.

If you're considering alternatives in addition to the space bar, that could be:

  • left/right arrow keys to toggle selection
  • up/down arrows to navigate between options

@jessarcher
Copy link
Member

@shane-smith Great! Thank you for letting me know and sharing those thoughts! 🙂

I'll have a think and chat with a few others.

All the best!

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.

2 participants