Skip to content

Conversation

@amyngu
Copy link
Contributor

@amyngu amyngu commented Feb 8, 2018

Pull request checklist

Description of changes

  • Adds "use current input" command to Suggestions when SearchMore is disabled and the input is valid
  • Changes to how "selected state" changes from the commands and the suggestions
  • Remove explicit "focus" on command buttons (causes onBlur - which really doesn't need to happen)

@amyngu amyngu requested a review from joschect as a code owner February 8, 2018 21:47
@amyngu
Copy link
Contributor Author

amyngu commented Feb 9, 2018

@joschect I'd love some input on this one!

}

@autobind
public tryHandleKeyDown(keyCode: number, currentSuggestionIndex: number): boolean {
Copy link
Contributor

Choose a reason for hiding this comment

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

Add a comment that return true means it was handled, and false means it wasn't

Copy link
Contributor

Choose a reason for hiding this comment

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

This entire function seems like it should be in the controller.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

How do I move this into the controller? The suggestionsController doesn't seem to be aware of the other elements in the suggestion element? (I may be missing something)

Copy link
Contributor

Choose a reason for hiding this comment

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

It's not really supposed to be aware. That said it makes sense that it would need to be aware in order to manage stuff like this. Perhaps the answer is to make SuggestionsController a react element whose render function only returns <Suggestions>. That way it can have a ref to suggestions, which in turn exposes an api for stuff like clicking the "search more" button. The main goal, in my mind, is to keep the "state manager" (SuggestionsController, maybe it should get renamed?) separate from the "view" (Suggestions). That way it's easy to mix and match the two and each one is clean, there isn't a conflating of state and form.

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've opened #3969 to address this

@autobind
private _useInput() {
if (this.props.createGenericItem) {
this.props.createGenericItem();
Copy link
Contributor

Choose a reason for hiding this comment

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

this feels more like it should be forceResolve or something like that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, that sounds like a much better name, I'll change that where applicable

@amyngu amyngu merged commit cdd6baf into microsoft:master Feb 14, 2018
@microsoft microsoft locked as resolved and limited conversation to collaborators Aug 31, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants