-
Notifications
You must be signed in to change notification settings - Fork 468
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(tag mode): strict selection behavior to only allow picking from suggestions #2278
Conversation
if (props.strictSelection && props.autosuggest) { | ||
if (cause === causes.SUGGESTION_SELECT || props.value !== undefined) { | ||
this.updateQueryHandler(props.componentId, queryHandlerValue, props); | ||
} else if (this.currentValue !== '') { | ||
} else if (this.currentValue !== '' && !props.strictSelection) { | ||
this.setValue('', true); | ||
} | ||
} else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:598 already checks for strictSelection
prop which makes the check for strictSelection
at L:608 unreachable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not seeing a check that would make it unreachable. At L598, the check is for isTagsMode
this.isSuggestionSelected = true; | ||
setTimeout(() => { | ||
this.isSuggestionSelected = false; | ||
}, 50); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@siddharthlatest Can you explain the reason for async toggle of isSuggestionSelected
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This fixes a side effect I am observing with two calls being made to this.setValue otherwise. See the use of the variable for the second place where the second call is being made from.
This PR fixes a behavior for tag mode where a user setting an input value that is not part of suggestions is not allowed when
strictSelection
mode is set.Components this applies to:
For code review, the main changes are in the first two commits: DataSearch code change, SearchBox code change
This change is available in
reactivesearch-vue
v1.35.3
. The changes in this PR should be cherry-picked to Vue v3 version and React v4 versions.