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

Fix required validation on suggest prompt #25

Merged
merged 1 commit into from
Aug 2, 2023
Merged

Conversation

jessarcher
Copy link
Member

This PR fixes an issue where validation occurs prematurely in the suggest prompt when the user selects one of the suggested values. This is most obvious when the suggest prompt is marked as required and the user selects a suggested value without typing anything to narrow the suggestions.

This is because there are two listeners for the "Enter" key - one in the SuggestPrompt class that sets the selected value if one has been highlighted and one in the TypedValue trait that submits the entered or selected value. This PR solves this by registering the "suggest-specific" key listeners first.

An alternative approach would be to pass the submit: false argument to the trackTypedValue method and handle the submit behaviour directly in SuggestPrompt instead.

Fixes #21

@taylorotwell taylorotwell merged commit 7601be4 into main Aug 2, 2023
5 checks passed
@taylorotwell taylorotwell deleted the suggest-required branch August 2, 2023 13:59
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 this pull request may close these issues.

The suggest prompt with a required flag not working as expected
2 participants