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

Suggest: Retain entered value on unfocus #3071

Closed
silverwind opened this issue Oct 24, 2018 · 9 comments · Fixed by #3289
Closed

Suggest: Retain entered value on unfocus #3071

silverwind opened this issue Oct 24, 2018 · 9 comments · Fixed by #3289

Comments

@silverwind
Copy link

Environment

  • Package version(s): @blueprintjs/select 3.2.0
  • Browser and OS versions: any

Feature request

I'm trying to makeSuggest work for search suggestions where users can enter any value and be provided with search suggestions, very similar to Google's search box.

My issue is that Suggest discards any non-matching user-entered value on unfocus. If no value is selected, it clears the entered value on unfocus. If a value has been previously selected, the entered value is replaced with the previously selected value.

Examples

I'd suggest a new option keepEnteredValues option to retain non-matching values or alternatively, make it the default behaviour, like it is for MultiSelect.

@giladgray
Copy link
Contributor

@silverwind could you perhaps make a gif demonstrating the issue?

@silverwind
Copy link
Author

Sure,

Let me show you MultiSelect first. It behaves as I would expect by retaining the value after entry and clicking outside:

multiselect

Next the same for Suggest. You notice that the displayed value is seemingly lost when clicking outside, but it reappears magically when clicking the element again. Also, I think the content should not be selectable with a single click.

suggest

I think this is more like a bug than a feature request really. MultiSelect does it right in my opinion.

@giladgray
Copy link
Contributor

nice. yeah i feel the MultiSelect behavior too, happy to support changing Suggest to match. @silverwind are you interested in making the PR?

@silverwind
Copy link
Author

I'll look into it.

@silverwind
Copy link
Author

Not sure I can actually contribute as I'm failing to get a development environment up.

yarn run compile errors with TS2694: Namespace 'ts' has no exported member 'ImportTypeNode'
yarn dev:select spews a lot of errors like TS2307: Cannot find module './generated/iconNames'

(This is using node 10.12, yarn 1.10.1, macOS 10.14)

My basic idea was to drop this line and debug what's happening to this value.

@giladgray
Copy link
Contributor

yeah i'm working on resolving this locally...

@giladgray
Copy link
Contributor

@silverwind i just merged #3078 so please merge latest develop and try building again.

i have never seen this ts error locally but seems quite common from contributors. not really sure what it's about.
definitely need to have a successful yarn compile before you can yarn dev anything.

@giladgray
Copy link
Contributor

@silverwind i just opened #3289 to address this issue. does it seem reasonable?

@silverwind
Copy link
Author

Looking good to me based on your gif. My only remaining concern is now the full-text selection on focus in Suggest which does not match the MultiSelect behaviour. I think it'd be as simple as removing this.selectText() in handleInputFocus. Would you mind trying that? I would send you a PR, but I had a lot of trouble getting the dev environment up.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants