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

selectOnClose: true should not select highlighted option when esc pressed #4579

Closed
4 of 11 tasks
dbeusee opened this issue Sep 13, 2016 · 4 comments
Closed
4 of 11 tasks

Comments

@dbeusee
Copy link

dbeusee commented Sep 13, 2016

Steps to reproduce the issue

  1. Use selectOnClose: true option.
  2. Highlight an option that's not the currently selected option.
  3. Press Esc

Expected behavior and actual behavior

When I follow those steps, I see...

I was expecting it to keep currently selected option, but actually it selected highlighted option. My goal for using selectOnClose was to have tab key work to select it.

Environment

Browsers

  • Google Chrome
  • Mozilla Firefox
  • Internet Explorer

Operating System

  • Windows 10
  • Mac OS X
  • Linux
  • Mobile

Libraries

  • jQuery version: 2.0.2
  • Select2 version: 4.0.3

Isolating the problem

  • This bug happens on the examples page
  • The bug happens consistently across all tested browsers
  • This bug happens when using Select2 without other pluigns
  • I can reproduce this bug in a jsbin
@alexweissman
Copy link
Contributor

As per the documentation, this is the expected behavior:

Select2 can be configured to automatically select the currently highlighted result when the dropdown is closed by using the selectOnClose option

See #4578 for a more detailed discussion of this behavior. I would tend to agree with you, that ESC should behave more like a "cancel" action, and keep the currently selected value.

It's also important to determine how this should behave in multi-select cases as well.

@dbeusee
Copy link
Author

dbeusee commented Sep 17, 2018

Hey pedrofurtado, why did you close my issue? And without a comment! Alex agreed that esc should act like cancel, basically undoing any change since entering the field leaving the previous value(s) unchanged.

@pedrofurtado
Copy link
Contributor

pedrofurtado commented Sep 17, 2018

We don't have immediate plans to provide this. We are focused to fix some major UI bugs (that are majority of issues and PR's). But if you open a PR with unit tests, I will be glad to review and approve if everything is ok 👍

@sattukishore
Copy link

@pedrofurtado this is happening in case of free text also(tags : true). Even when entered sometext and clicking inside input field creating pill. Any solutions how to prevent this??

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants