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

React/DP-13718: Fuzzy search default suggestions. #544

Merged
merged 23 commits into from
May 1, 2019

Conversation

clairesunstudio
Copy link
Contributor

@clairesunstudio clairesunstudio commented Apr 26, 2019

Minor
Added

  • (React) [InputTextFuzzy] DP-13688: Added option to render all options as suggestions by default, via prop renderDefaultSuggestion
  • (React) [Storybook Config] DP-13688: Added storybook console addon

Removed

  • (React) [InputTextTypeAhead] DP-13688: Deprecate InputTextTypeAhead.

To test:
yarn link-mayflower in budget: https://github.com/massgov/budget/pull/242

@clairesunstudio clairesunstudio changed the title build suggestions React/ Fuzzy search default suggestions Apr 26, 2019
@clairesunstudio clairesunstudio requested review from smurrayatwork and avrilpearl and removed request for smurrayatwork April 29, 2019 15:52
@smurrayatwork smurrayatwork changed the title React/ Fuzzy search default suggestions React/DP-13718: Fuzzy search default suggestions. Apr 30, 2019
});
} else {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this change on purpose? moving the callback into setState in the if block will only callback if value is empty?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since we are not using state in props.onChange function, what's the difference putting it in callback vs outside of setState? if we pass it as callback we will have to do it in the setState below also

highlightedItemIndex: null
}, () => {
if (is.fn(this.props.onSuggestionClick)) {
this.props.onSuggestionClick(event, {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i don't think we should pass this callback in blur

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

onSuggestionClick is when you select on a suggestion, e.g. we use it to navigate to a url and that shouldn't be triggered onBlur

onKeyDown: (event, { newHighlightedSectionIndex, newHighlightedItemIndex }) => {
onFocus: this.handleFocus,
onBlur: (event) => {
event.persist();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't think we need to persist this event unless we want to pass a custom callback

@avrilpearl avrilpearl merged commit f212e6c into develop May 1, 2019
@avrilpearl avrilpearl deleted the react/DP-13688-fuzzy-show-all-options branch May 1, 2019 17:14
@clairesunstudio clairesunstudio mentioned this pull request May 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants