The second Backspace being interpreted as navigating to previous page

54 views
Skip to first unread message

cca...@dtsgis.com

unread,
Aug 27, 2015, 3:24:05 PM8/27/15
to select2
This seems to be a in bug, observed in ie 10. In chrome, this behaves as expected

example: Multiple select boxes on https://select2.github.io/examples.html

1. click box
2. select Alaska
3. Select Hawaii
4. Click box like you were going to enter a 3rd state
5. hit backspace.
6. Note that the cursor doesn't go back in the text box
7. Hit Backspace a 2nd time.


This primarily occurs if the user is trying to erase the existing selections using backspace. If they just treat it like a text box and hit backspace several times to clear it, they wind up navigating back out of the page.

Expected behavior: The text box that the user is typing in should retain focus.

cca...@dtsgis.com

unread,
Aug 27, 2015, 3:36:01 PM8/27/15
to select2, cca...@dtsgis.com
if I use ie's javascript debugging and trace through the javascript, it seems to behave in a much more reasonable manner, so perhaps it's a race condition?

cca...@dtsgis.com

unread,
Sep 2, 2015, 12:03:39 PM9/2/15
to select2, cca...@dtsgis.com
On Thursday, August 27, 2015 at 3:36:01 PM UTC-4, cca...@dtsgis.com wrote:
> if I use ie's javascript debugging and trace through the javascript, it seems to behave in a much more reasonable manner, so perhaps it's a race condition?

Here's the changes I made.

Index: select2.js
===================================================================
@@ -1789,6 +1789,9 @@
self.$search.attr('tabindex', 0);

self.$search.focus();
+ window.setTimeout(function () {
+ self.$search.focus();
+ }, 0);
});

container.on('close', function () {
@@ -1887,7 +1890,8 @@

this.trigger('open');

- this.$search.val(item.text + ' ');
+ this.$search.val(item.text);
+ this.resizeSearch();
};

Search.prototype.resizeSearch = function () {

Kevin Brown

unread,
Sep 2, 2015, 12:33:34 PM9/2/15
to select2, cca...@dtsgis.com
Any chance you can check to see if this problem is still happening on the latest master branch of Select2?

I thought I fixed this issue a while back, and haven't been able to reproduce it locally, but I haven't had anyone confirm it.

--
You received this message because you are subscribed to the Google Groups "select2" group.
To unsubscribe from this group and stop receiving emails from it, send an email to select2+u...@googlegroups.com.
To post to this group, send email to sel...@googlegroups.com.
Visit this group at http://groups.google.com/group/select2.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages