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

search parameter input closes when you click on it #38

Closed
DarioSacco opened this issue Feb 5, 2016 · 8 comments · May be fixed by #40
Closed

search parameter input closes when you click on it #38

DarioSacco opened this issue Feb 5, 2016 · 8 comments · May be fixed by #40

Comments

@DarioSacco
Copy link

The ng-blur on the input with name = "value" fires also when you click onto the word you are typing. I want the input to leave the edit mode only when you click OUT of the input bar

@dnauck
Copy link
Owner

dnauck commented Feb 6, 2016

I'm using here the standard ng-blur directive from angular, any idea how we can fix this?

@Corwynt
Copy link

Corwynt commented Feb 8, 2016

Should be fixed with:
#40

@DarioSacco
Copy link
Author

Can you explain what your code does? It doesn't work for me.
I was thinking, when the blur fires, to check if the e.target.name is "value" and in that case do nothing (because I want to leave the edit mode only on enter key or click elsewhere) but there's something ignoring that check and the search param leaves the edit mode even before it (probably is the $scope.$watch inside the nitSetFocus directive)

@Corwynt
Copy link

Corwynt commented Feb 8, 2016

The target element in the Blur event is the Element with the ng-blur directive. In my test case the HTML-Element which caused, that the input element lost its focus was event.relatedTarget.
To check if it is an Typeahed element i check if the parent Element's id attribute includes the word "typeahead".

@DarioSacco
Copy link
Author

I was not referring to typeahead elements but the search param where you tipe in the values to filter with.
Anyway I fixed it using the check I was talking before: added an if in the watch block like this

$scope.$watch(model, function (value) {
                            if (value === true) {
                                $timeout(function () {
                                    if ($element[0].name === "value")
                                        $element[0].focus();
                                });
                            }
                        });

@dnauck
Copy link
Owner

dnauck commented Mar 24, 2016

Thanks for you help. I'll try to understand and test your contributions.

@dnauck dnauck closed this as completed in 18b3d66 Mar 29, 2016
@dnauck dnauck reopened this Mar 29, 2016
@dnauck
Copy link
Owner

dnauck commented Mar 29, 2016

Please test my latest commit if this fixes both issues.

@dnauck
Copy link
Owner

dnauck commented May 3, 2016

Closing this now, please reopen if issue is still present

@dnauck dnauck closed this as completed May 3, 2016
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.

3 participants