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
when use multi-select with [closeOnSelect: false] each time you select option the menu scroll to the first option. v4.0.3 #4417
Comments
This bug is a byproduct of the commit to fix #4238. I'm not sure what the best course of action on this is, but I'd argue that the "highlight first item" feature should be adjusted to work either only in the infinite scroll case (while the popup is open and the user is scrolling), or via a user-set option. @AlexanderLeonov Any ideas on how the highlightFirstItem could be tweaked to fix this case? I use the control without infinite scrolling (my option set is fixed size), and I find it annoying that the first selected item is scrolled into view when I'm editing my choices. Here are the commits that introduce this code: |
Totally agree with @jgbishop here. I don't know enough about this project to try to fix this by myself and make a pull request. |
@jgbishop, you are not entirely correct. I've walked through the commits and discovered that this change was actually introduced by the commit 9f58128, particularly by adding PS. Actually, I'm not even entirely clear on the whole idea of highlighting the first item after selecting something. |
The issue stems from the call to self.highlightFirstItem() on line 279 of results.js. This was introduced in commit e897d00 as self.focusFirstItem(). @kevin-brown @AlexanderLeonov, why is this call made on select? Is there any reason for highlighting the first selected element on selection? Removing this call will solve the issue. |
There's a proposed solution in #4584 if(!(self.options.get('multiple') && !self.options.get('closeOnSelect'))) {
self.highlightFirstItem();
} |
#4869 also addresses the problem. This solution needs to be compared to the solution proposed in #4584, which is to add some logic to conditionally invoke
@MicahBrown could you please take a look at this? |
Find this part of the select2.min.js and delete it. ,f=this.$results.scrollTop()+(e-d),g=e-d;f-=2*a.outerHeight(!1),c<=2?this.$results.scrollTop(0):(g>this.$results.outerHeight()||g<0)&&this.$results.scrollTop(f) It worked for me |
@smalezan deleting minified, compiled code is literally the worst possible way to solve a problem like this. Please take some time to learn about version control, minification, and the general concept of a "build step" in deploying an application. |
@kevin-brown @alexweissman is there update regarding this? Is there a way to fix this issue? |
@kevin-brown @alexweissman any news for fix this issue? |
@kevin-brown @alexweissman It's good to add this fix in next release (4.0.6). So, all users can get this fix. |
@kevin-brown @alexweissman I've had to put this work around manually into our version, is there any update of whether this will make it into the 4.0.6 release? It doesn't currently seem to be in the milestones. |
@kevin-brown @alexweissman could you please put this fix into a release? |
This is horrible. The Multi-Select is almost unusable because of this auto-top-scroll on every selection. How come this isn't part of the plugin yet? When will this be fixed? What should we do in the meantime (it's Sep. 2018 currently)? |
Current solution which works for me Replace this highlightFirstItem function() {...} to be "{return false;}" as below:
|
This issue can be closed. The solution is already merged in #5150 . There are some docs improvements (these links is in the PR page) to explaining how to config select2 to fix this bug. |
When would the next release be @pedrofurtado ? |
@nikhilzac95 In next weeks, I am planning to release a 4.0.x with this and other UI bug fixes. |
Thanks for the update @pedrofurtado 👍 |
When would the next release be @pedrofurtado ? |
@pedrofurtado the last time we spoke on Sept 12, you told me we'll do a release in a couple of weeks. Can you do it any soon? Would really appreciate it. 💯 |
Hey @pedrofurtado , any updates on this bug fix ?? |
@pedrofurtado , this issue still remains in v4.0.6-rc.1. Any solution? |
Just got released: https://github.com/select2/select2/releases/tag/4.0.6 |
Although Version 4.0.6 fixes this Autoscroll-To-First bug in MultiSelect, another bug got introduced in this version. c.prototype.highlightFirstItem=function(){ return false; } Now I can close my flat single-selects, AND avoid the autoscroll-to-first in multi-selects, all on the same page. |
Have you considered upgrading to the latest version of Select2, 4.0.13? |
By Removing this.ensureHighlightVisible() from select2.js work for me |
this code working fine for my side, I hope this will help you. $('#selectmultiple').select2({ |
when use multi-select with [closeOnSelect: false] each time you select option the menu scroll to the first option .
then scroll again down to select another option its do not keep the last position i stood on v4.0.3
example:
1- select (a)
2- after select (i) the menu scroll to (a) again
Environment
Libraries
The text was updated successfully, but these errors were encountered: