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 query appears out of order in IE -- especially with Select2 ajax #463

Closed
jesperronn opened this issue Oct 3, 2012 · 3 comments
Closed

Comments

@jesperronn
Copy link
Contributor

Try this on the demo example "Loading Remote Data" in IE8:

Given a select2 element has focus (but is not open so the actual search field is not visible)

When I type "sin" in normal fast type,
Then I should see "sin" in the search field"

Actual output differs depending on the speed you type. Sometimes "sin" becomes "in", sometimes "isn", where the actual order is changed

The previous issues #369 and #354 fixes an issues about clicking select 2 box and not opening.

However, that workaround waps an extra setTimeout() around a call to focus and open the search field when opening (the searchFocus() method)

@kevin-brown
Copy link
Member

This is more of a race condition which I think has been addressed. The issue is that the search box is not opened quick enough for the input box to be selected.

@jesperronn
Copy link
Contributor Author

@kevin-brown you're probably right about this being a race condition. But it is definitely not fixed. The commits I mentioned attempt to fix issues about this opening it. But in reality, the IE issues are still there. In reality, the Select2 component has focus. But unlike other autocomplete components, the field you type into is not visible.

Select2 shows a "container" (the div- element). When you start typing, then you show a stand-in text field. And since it (the "search" field) is not visible, the code attempts to record the first key pressed.

You will find the code in "focusSearch" around line 1310 of select2.js.

The problems occur for me in IE when I use ajax responses to populate the results. And typing at normal speed really makes that first letter to occur later in the search field.

I was thinking, could we overcome this problem by always having the "search" field visible? If we change the design so the search field is not hidden/shown, then this problem would never occur, right?

However, this would also change the entire state of the "focus" state of Select2 -- where the container has focus, but the search+result area is not open.

Is this possible, from an interaction part of view?

@ivaynberg
Copy link
Contributor

this should be fixed in 3.3

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