selectOnClose for keyboard selections only

109 views
Skip to first unread message

Jonah Greenthal

unread,
Dec 17, 2015, 1:41:56 PM12/17/15
to select2
Several of my users like the select-on-close behavior when they choose an option using the keyboard's up/down arrow keys, but find that it often selects something they didn't intend to because their mouse happens to be over an option when they "tab through" the dropdown. (Let me know if the behavior I'm describing isn't clear.) Is there any way to have select-on-close only apply to selections made with the keyboard, not selections "made" with the mouse? If there's not currently, could there be? Thanks!

Kevin Brown

unread,
Dec 19, 2015, 9:39:54 PM12/19/15
to select2
Unfortunately the "select on close" functionality works by selecting the option that is highlighted when the dropdown is closed. So if their mouse happens to highlight an option as they are going through, that will be the one that is selected.

That's assuming that their mouse actually moves before the dropdown is closed. If it's just hovering over, and they moved the highlight with their keyboard, then that would actually be a bug. If that is the case, can you open a ticket on GitHub about it?

On Thu, Dec 17, 2015 at 1:41 PM Jonah Greenthal <jonahgr...@gmail.com> wrote:
Several of my users like the select-on-close behavior when they choose an option using the keyboard's up/down arrow keys, but find that it often selects something they didn't intend to because their mouse happens to be over an option when they "tab through" the dropdown. (Let me know if the behavior I'm describing isn't clear.) Is there any way to have select-on-close only apply to selections made with the keyboard, not selections "made" with the mouse? If there's not currently, could there be? Thanks!

--
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 https://groups.google.com/group/select2.
For more options, visit https://groups.google.com/d/optout.

Jonah Greenthal

unread,
Dec 19, 2015, 10:35:07 PM12/19/15
to select2
> Unfortunately the "select on close" functionality works by selecting the
> option that is highlighted when the dropdown is closed. So if their mouse
> happens to highlight an option as they are going through, that will be the
> one that is selected.

Right. I was just wondering if there could be an option to do what I
wanted (only consider options highlighted via the keyboard). If not,
would it be fairly easy to fake using event triggers?


> That's assuming that their mouse actually moves before the dropdown is
> closed. If it's just hovering over, and they moved the highlight with their
> keyboard, then that would actually be a bug. If that is the case, can you
> open a ticket on GitHub about it?

No, it does not appear to be a bug.
Reply all
Reply to author
Forward
0 new messages