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

Don't invoke afterSelect if user entered nothing #22

Merged
merged 4 commits into from Nov 9, 2015

Conversation

pdyraga
Copy link
Contributor

@pdyraga pdyraga commented Nov 4, 2015

Fixes issue #21

Added conditional check that makes afterSelect not to be invoked when user entered nothing in the text search field. This prevents from the following scenario:

  1. User opens page, clicks inside search field
  2. User enters nothing, clicks out of search field
  3. afterSelect gets invoked <-- !!!

With change introduced in this PR, afterSelect will not get invoked in a scenario described above. However, if user entered anything and then clicked out of text field, afterSelect will be invoked with null param. The same if user cleared previous selection - afterSelect will be invoked with null param.

Piotr Dyraga added 2 commits November 4, 2015 08:05
Added conditional check that makes afterSelect not to be invoked when user entered nothing in the text search field. This prevents from the following scenario:
1. User opens page, clicks inside search field
2. User enters nothing, clicks out of search field
3. 'afterSelect' gets invoked <-- !!!

With change introduced in this commit, afterSelect will not get invoked in a scenario described above. However, if user entered anything and then clicked out of text field, afterSelect will be invoked with null param. The same if user cleared previous selection - afterSelect will be invoked with null param.
@@ -177,8 +177,9 @@ elemicaSuggest 0.9.1-SNAPSHOT

if $valueInput.val() == ""
if noSuggestionMatched($target.val(), afterSelect)
val = $target.val()
Copy link
Contributor

Choose a reason for hiding this comment

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

originalValue perhaps?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍 good idea

@lukaszlenart
Copy link
Contributor

Looks good to me! 👍

lukaszlenart added a commit that referenced this pull request Nov 9, 2015
Don't invoke afterSelect if user entered nothing
@lukaszlenart lukaszlenart merged commit 6247c3e into master Nov 9, 2015
@lukaszlenart lukaszlenart deleted the after-select-on-blur branch November 9, 2015 09:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants