[Django] #31522: FilteredSelectMultiple widget jumps to top when an option is added

23 views
Skip to first unread message

Django

unread,
Apr 28, 2020, 4:28:59 AM4/28/20
to django-...@googlegroups.com
#31522: FilteredSelectMultiple widget jumps to top when an option is added
-----------------------------------------+------------------------
Reporter: Shai Berger | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: master
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-----------------------------------------+------------------------
When using a FilteredSelectMultiple as a widget for a MultipleChoice
field, typically the list of options is longer than what fits in the
control. If the user then scrolls down, selects some options, and clicks
the arrow to move them to the "chosen" box, then they are correctly added,
but the "available" box scrolls to the top.

It would be much nicer if the "available" box stayed where it was.

At [https://www.matific.com Matific] where we encountered this, we
monkeypatched the control's media to add a JavaScript file with this code:
{{{
(function($){
if(!SelectBox)
return;

var oldRedisplay = SelectBox.redisplay;

if(typeof oldRedisplay !== 'function')
return;

SelectBox.redisplay = function(id) {
var top = $('#'+id).scrollTop(); //record current scroll
var res = oldRedisplay.apply(this, arguments);
$('#'+id).scrollTop(top); // Restore the scroll
return res;
};
})(django.jQuery);
}}}

I'm attaching a minimal project to demonstrate it.

--
Ticket URL: <https://code.djangoproject.com/ticket/31522>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Apr 28, 2020, 5:37:37 AM4/28/20
to django-...@googlegroups.com
#31522: FilteredSelectMultiple widget jumps to top when an option is added
-------------------------------+--------------------------------------

Reporter: Shai Berger | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: master
Severity: Normal | Resolution:

Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Changes (by Shai Berger):

* Attachment "multiselect.tgz" added.

This project has a user "shai" with password "1" to log in to the admin in
the included database

Django

unread,
Apr 28, 2020, 5:39:01 AM4/28/20
to django-...@googlegroups.com
#31522: FilteredSelectMultiple widget jumps to top when an option is added
-------------------------------+--------------------------------------

Reporter: Shai Berger | Owner: nobody
Type: Uncategorized | Status: new
Component: contrib.admin | Version: master
Severity: Normal | Resolution:

Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 1

-------------------------------+--------------------------------------
Changes (by Shai Berger):

* ui_ux: 0 => 1
* component: Uncategorized => contrib.admin
* easy: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/31522#comment:1>

Django

unread,
Apr 28, 2020, 8:19:47 AM4/28/20
to django-...@googlegroups.com
#31522: FilteredSelectMultiple widget jumps to top when an option is added
-------------------------------+--------------------------------------

Reporter: Shai Berger | Owner: nobody
Type: Bug | Status: new

Component: contrib.admin | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 1
-------------------------------+--------------------------------------
Changes (by Shai Berger):

* type: Uncategorized => Bug


--
Ticket URL: <https://code.djangoproject.com/ticket/31522#comment:2>

Django

unread,
Apr 28, 2020, 8:12:52 PM4/28/20
to django-...@googlegroups.com
#31522: FilteredSelectMultiple widget jumps to top when an option is added
-------------------------------+---------------------------------------
Reporter: Shai Berger | Owner: TapanGujjar
Type: Bug | Status: assigned

Component: contrib.admin | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 1
-------------------------------+---------------------------------------
Changes (by TapanGujjar):

* owner: nobody => TapanGujjar
* status: new => assigned


--
Ticket URL: <https://code.djangoproject.com/ticket/31522#comment:3>

Django

unread,
Apr 29, 2020, 1:15:46 AM4/29/20
to django-...@googlegroups.com
#31522: FilteredSelectMultiple widget jumps to top when an option is added.
-------------------------------------+-------------------------------------
Reporter: Shai Berger | Owner:
Type: | TapanGujjar
Cleanup/optimization | Status: assigned

Component: contrib.admin | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 1
-------------------------------------+-------------------------------------
Changes (by felixxm):

* type: Bug => Cleanup/optimization
* stage: Unreviewed => Accepted


--
Ticket URL: <https://code.djangoproject.com/ticket/31522#comment:4>

Django

unread,
Apr 30, 2020, 10:38:17 PM4/30/20
to django-...@googlegroups.com
#31522: FilteredSelectMultiple widget jumps to top when an option is added.
-------------------------------------+-------------------------------------
Reporter: Shai Berger | Owner:
Type: | TapanGujjar
Cleanup/optimization | Status: assigned
Component: contrib.admin | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 1
-------------------------------------+-------------------------------------
Changes (by TapanGujjar):

* has_patch: 0 => 1


Comment:

https://github.com/django/django/pull/12833

--
Ticket URL: <https://code.djangoproject.com/ticket/31522#comment:5>

Django

unread,
May 4, 2020, 3:32:03 AM5/4/20
to django-...@googlegroups.com
#31522: FilteredSelectMultiple widget jumps to top when an option is added.
-------------------------------------+-------------------------------------
Reporter: Shai Berger | Owner:
Type: | TapanGujjar
Cleanup/optimization | Status: assigned
Component: contrib.admin | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 1 | UI/UX: 1
-------------------------------------+-------------------------------------
Changes (by felixxm):

* needs_better_patch: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/31522#comment:6>

Django

unread,
May 5, 2020, 6:19:10 PM5/5/20
to django-...@googlegroups.com
#31522: FilteredSelectMultiple widget jumps to top when an option is added.
-------------------------------------+-------------------------------------
Reporter: Shai Berger | Owner:
Type: | TapanGujjar
Cleanup/optimization | Status: assigned
Component: contrib.admin | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 1 | UI/UX: 1
-------------------------------------+-------------------------------------
Changes (by TapanGujjar):

* cc: TapanGujjar (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/31522#comment:7>

Django

unread,
May 6, 2020, 6:44:49 PM5/6/20
to django-...@googlegroups.com
#31522: FilteredSelectMultiple widget jumps to top when an option is added.
-------------------------------------+-------------------------------------
Reporter: Shai Berger | Owner:
Type: | TapanGujjar
Cleanup/optimization | Status: assigned
Component: contrib.admin | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 1
-------------------------------------+-------------------------------------
Changes (by TapanGujjar):

* needs_better_patch: 1 => 0


Comment:

https://github.com/django/django/pull/12833

--
Ticket URL: <https://code.djangoproject.com/ticket/31522#comment:8>

Django

unread,
Jul 1, 2020, 10:33:11 AM7/1/20
to django-...@googlegroups.com
#31522: FilteredSelectMultiple widget jumps to top when an option is added.
-------------------------------------+-------------------------------------
Reporter: Shai Berger | Owner:
Type: | TapanGujjar
Cleanup/optimization | Status: assigned
Component: contrib.admin | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 1
-------------------------------------+-------------------------------------
Changes (by felixxm):

* stage: Accepted => Ready for checkin


--
Ticket URL: <https://code.djangoproject.com/ticket/31522#comment:9>

Django

unread,
Jul 1, 2020, 3:59:49 PM7/1/20
to django-...@googlegroups.com
#31522: FilteredSelectMultiple widget jumps to top when an option is added.
-------------------------------------+-------------------------------------
Reporter: Shai Berger | Owner:
Type: | TapanGujjar
Cleanup/optimization | Status: closed
Component: contrib.admin | Version: master
Severity: Normal | Resolution: fixed

Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 1
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak <felisiak.mariusz@…>):

* status: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"2d67222472f80f251607ae1b720527afceba06ad" 2d672224]:
{{{
#!CommitTicketReference repository=""
revision="2d67222472f80f251607ae1b720527afceba06ad"
Fixed #31522 -- Made admin's SelectBox preserve scroll position.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/31522#comment:10>

Reply all
Reply to author
Forward
0 new messages