-
Notifications
You must be signed in to change notification settings - Fork 324
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
Make ModulesSelect remain open after selection #655
Make ModulesSelect remain open after selection #655
Conversation
Deploy preview ready! Built with commit 822b2ca |
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 for the PR! Do take note of the bugs and see if you can fix them.
}; | ||
|
||
onStateChange = (changes: any) => { | ||
if (Object.prototype.hasOwnProperty.call(changes, 'inputValue')) { |
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.
Just use _.has
for this. Also, combine the two if
statements
if (Object.prototype.hasOwnProperty.call(changes, 'inputValue')) { | ||
if (!Object.prototype.hasOwnProperty.call(changes, 'selectedItem')) { | ||
this.setState({ | ||
inputValue: changes.inputValue, |
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 see two bugs (not entirely sure if they are caused by this specific line, will investigate a bit further when I have time)
- When blurring after selecting an item, this causes the input value to be set to the last select item's value (ie. it's module code), not the last input value
- Cursor position is reset if you try to edit the middle of the search query
Oh, and ignore the CircleCI failure - that's because of a config error on our part I think |
- Fix cursor jumping to the end of the input - Refactor `ModulesSelect`
Here's what I changed in the latest commit 4e95fac:
There is, however, a bug on mobile that I haven't figure out a fix. If you switch to numeric keyboard and type a digit, it will return back to the alpha keyboard. |
isOpen: boolean, | ||
isModalOpen: boolean, | ||
inputValue: string, | ||
selectedItem: any, |
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 should probably match the type of item
property that was passed into getItemProp
, which is ModuleCode
. Since it is nullable, this should be ?ModuleCode
@nexolute Good stuff, thanks for the PR! |
1a01842
to
7b04ffd
Compare
39d2e3f
to
8897161
Compare
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.
@nexolute Thanks for this PR, and sorry it took so long! |
This PR is made with respect to #598.
I had implemented @yangshun original solution: