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

Consider calling search callback after a blur ? #152

Open
Intrepidd opened this issue Aug 11, 2015 · 6 comments
Open

Consider calling search callback after a blur ? #152

Intrepidd opened this issue Aug 11, 2015 · 6 comments

Comments

@Intrepidd
Copy link

Consider the following jsfiddle : https://jsfiddle.net/zL847sqy/

If you type : "title" then tab, then a value, then tab again (or click outside of the field), the search callback is not fired.

Of course one could use the blur callback (as commented in the fiddle) but this is unreliable as you would only want the callback to be fired after a change, not for each blur, imagine a search being performed live after each call to the search callback.

WDYT ?

@samuelclay
Copy link
Member

You could just add a check to the blur callback for any difference between the latest query and a cached value of the last search query.

@Intrepidd
Copy link
Author

Of course, but I thought this could be VS responsibility

@zekedroid
Copy link

Going along these lines, is it possible to make the "tab" key on a "value" go to the next set of facet, value inputs? As opposed to what happens now which is that it blurs the input. Basically what I'm asking is for a way to "match" the value regardless of whether it actually matched or not. The use case is that we allow for values not in the callbacks of the facetMatching method.

I considered a 'keydown' event, checking for a 'tab' keypress. However this won't work because I can't attach an event to non-existing input fields.

I also tried setting this as the value matching callback:

valueMatches: function(facet, searchTerm, callback) {
    callback([searchTerm])
}

At first I thought it might be an ugly solution, but it still won't work because it will actually execute a search on tab (which incidentally does what @Intrepidd wanted to do). So maybe if this is the only simple solution, is there a way to stop the search event from firing on tab?

@samuelclay
Copy link
Member

To achieve what you want just turn the autosearch option false. Search the codebase for references to app.options.autosearch. This turns off automatic searching when removing facets and autocompleting facets.

@samuelclay
Copy link
Member

Also, it shouldn't be blurring the input on tab. If that's happening thats a bug and should be filed separately. Make sure you mention your browser and OS.

@zekedroid
Copy link

Alright let me give that one a try. And as for the blurring, I could've sworn it was the intended behavior. Try it out on the fiddle that Intrepidd posted on this thread.

Meanwhile, here it is:

OS: Windows, Linux, Mac OS
Browsers: Chrome latest (45), Edge, Safari

To replicate, enter a category, tab over to the value, enter something, tab again. After that tab, it won't go to the next set but will just blur out.

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

No branches or pull requests

3 participants