-
Notifications
You must be signed in to change notification settings - Fork 94
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
The suggest prompt with a required flag not working as expected #21
Comments
I tested, same here. 👍 |
For me this is the fix
but I do not have time to write a test. Maybe it might help. Problem is the TypedValue.php trait is submitting before the selectHighlighted has run in SuggestPrompt foreach (str_split($key) as $key) {
if ($key === Key::ENTER && $submit) {
$this->submit(); |
Can everyone retest this on Laravel Framework 10.17 |
Thanks for reporting this. I've confirmed the issue. This seems to solve it for me, as it makes the - $this->trackTypedValue($default);
$this->on('key', fn ($key) => match ($key) {
Key::UP, Key::SHIFT_TAB => $this->highlightPrevious(),
Key::DOWN, Key::TAB => $this->highlightNext(),
Key::ENTER => $this->selectHighlighted(),
Key::LEFT, Key::RIGHT => $this->highlighted = null,
default => (function () {
$this->highlighted = null;
$this->matches = null;
})(),
});
+ $this->trackTypedValue($default); Can you please confirm whether this change would fix things for you? I can't see any regressions it would cause. |
I've created #25 to solve this. Please let me know if you discover any issues with it though. Thanks again! |
Tested #25 and couldn't find any issues. |
Laravel Prompts Version
0.1.1
Laravel Version
10.14.1
PHP Version
8.1.2
Operating System & Version
Ubuntu 22.04.2 LTS
Terminal Application
VScode
Description
Hi,
It seems like a weird interaction between the "suggest" prompt and the required flag where the first time you select an option you get the "Required" error.
Steps To Reproduce
The text was updated successfully, but these errors were encountered: