-
-
Notifications
You must be signed in to change notification settings - Fork 5.3k
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
Feature: Blur input on suggestion create #6646
Feature: Blur input on suggestion create #6646
Conversation
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.
Thanks!
@@ -210,7 +210,16 @@ export const getSuggestionsFactory = ({ | |||
suggestions = choices; | |||
} | |||
} else { | |||
suggestions = choices.filter(choice => matchSuggestion(filter, choice)); | |||
if (Array.isArray(selectedItem)) { |
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 a little unsure about this change.
When I changed CommentEdit
's matchSuggestion
function it caused this logic to fail,, because it was no longer returning true unconditionally. I then adjusted the logic to not return a suggestion if it matches the filterValue (since there's no point in displaying).
This then breaks the functionality for the AutocompleteArrayInput
. SO I've just forked the logic. I'm not happy with this, so I'd love one of the RA core member's thoughts on this
const onCreateNewItem = () => { | ||
inputEl.current.blur(); | ||
}; |
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 think we don't need the onCreateNewItem
and we can just call inputEl.current.blur();
at the end of the effect which run when the input value changes at L283.
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 made the change btw
Thanks! |
Closes #6622
Behaviour when optionValue is text
autosuggestion-text.mov
Behaviour when optionValue is function
autosuggestion-function.mov
Behaviour when optionValue is a component
autosuggestion-component.mov
Note: the latter seems to break some behaviour because before
matchSuggestion
previously always returnedtrue
. You can see from the video that the autocomplete doesn't quite work as expected anymore