#33491 closed Cleanup/optimization (fixed)
Rows are selected only on Chrome when going back from the confirmation page.
| Reported by: | Akihito Yokose | Owned by: | Marcelo Galigniana | 
|---|---|---|---|
| Component: | contrib.admin | Version: | 3.2 | 
| Severity: | Normal | Keywords: | |
| Cc: | Marcelo Galigniana | Triage Stage: | Ready for checkin | 
| Has patch: | yes | Needs documentation: | no | 
| Needs tests: | no | Patch needs improvement: | no | 
| Easy pickings: | no | UI/UX: | no | 
Description
On the admin site, I've found a feature that existed in Django 2.2 but was lost with the update to Django 3.2.
In Django 2.2, if you clicked the "No, take me back" button on the delete confirmation page, the background color of the checked rows would remain highlighted and the action-counter display would remain counted up on the change list page. However, in Django 3.2, the background color of the selected row is not highlighted and the action-counter display is "0 of X selected" (see attached images).
The reason for this is probably that the following process in django/contrib/admin/static/admin/js/actions.js was removed during the update to Django 3.2.
// Show counter by default
$(options.counterContainer).show();
// Check state of checkboxes and reinit state if needed
$(this).filter(":checked").each(function(i) {
    $(this).parent().parent().toggleClass(options.selectedClass);
    updateCounter();
    if ($(options.acrossInput).val() === 1) {
        showClear();
    }
});
A related Issue is https://github.com/django/django/pull/12820.
Attachments (4)
Change History (16)
by , 4 years ago
| Attachment: | image_01.png added | 
|---|
by , 4 years ago
| Attachment: | image_02.png added | 
|---|
by , 4 years ago
| Attachment: | django_2_2.mp4 added | 
|---|
by , 4 years ago
| Attachment: | django_3_2.mp4 added | 
|---|
comment:1 by , 4 years ago
| Resolution: | → needsinfo | 
|---|---|
| Status: | new → closed | 
| Summary: | Missing feature in actions.js (Django 3.2 and later) → Selected rows are not highlighted when going back from the confirmation page. | 
comment:2 by , 4 years ago
Mariusz, thanks for the info.
It may depend on your browser.
The results I checked on my Windows PC are as follows.
Chrome 98 and Edge 98:
- Django 2.2: OK
- Django 3.2: NG
However, the situation was different with Firefox.
Firefox 96:
- Django 2.2: NG
- Django 3.2: NG
comment:3 by , 4 years ago
| Has patch: | set | 
|---|---|
| Needs tests: | set | 
| Patch needs improvement: | set | 
| Resolution: | needsinfo | 
| Status: | closed → new | 
| Summary: | Selected rows are not highlighted when going back from the confirmation page. → Rows are selected only on Chrome when going back from the confirmation page. | 
| Triage Stage: | Unreviewed → Accepted | 
| Type: | Bug → Cleanup/optimization | 
Thanks for details. I'd say it wasn't an intended feature, since it's browser specific. IMO, we should enforce clearing checkboxes, instead of highlighting rows on Chrome. This would make this behavior browser-agnostic.
comment:4 by , 4 years ago
| Has patch: | unset | 
|---|---|
| Needs tests: | unset | 
| Patch needs improvement: | unset | 
comment:5 by , 3 years ago
| Cc: | added | 
|---|
comment:6 by , 3 years ago
| Owner: | changed from to | 
|---|---|
| Status: | new → assigned | 
comment:8 by , 3 years ago
| Patch needs improvement: | set | 
|---|
comment:9 by , 3 years ago
| Patch needs improvement: | unset | 
|---|
comment:10 by , 3 years ago
| Triage Stage: | Accepted → Ready for checkin | 
|---|
For me, it works exactly the same in Django 2.2 and 3.2, in both cases rows are not highlighted or selected. Can you provide a sample project that reproduces this issue?