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.
--
Ticket URL: <https://code.djangoproject.com/ticket/33491>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* Attachment "image_01.png" added.
* Attachment "image_02.png" added.
* Attachment "django_2_2.mp4" added.
* Attachment "django_3_2.mp4" added.
* status: new => closed
* resolution: => needsinfo
Comment:
For me, it works exactly the same in
[https://code.djangoproject.com/attachment/ticket/33491/django_2_2.mp4
Django 2.2] and
[https://code.djangoproject.com/attachment/ticket/33491/django_3_2.mp4
3.2], in both cases rows are not highlighted or selected. Can you provide
a sample project that reproduces this issue?
--
Ticket URL: <https://code.djangoproject.com/ticket/33491#comment:1>
Comment (by Akihito Yokose):
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
--
Ticket URL: <https://code.djangoproject.com/ticket/33491#comment:2>
* status: closed => new
* needs_better_patch: 0 => 1
* needs_tests: 0 => 1
* type: Bug => Cleanup/optimization
* has_patch: 0 => 1
* resolution: needsinfo =>
* stage: Unreviewed => Accepted
Comment:
Thanks for details. I'd say it was 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
--
Ticket URL: <https://code.djangoproject.com/ticket/33491#comment:3>
* needs_better_patch: 1 => 0
* has_patch: 1 => 0
* needs_tests: 1 => 0
--
Ticket URL: <https://code.djangoproject.com/ticket/33491#comment:4>
* owner: nobody => yash112-lang
* status: new => assigned
--
Ticket URL: <https://code.djangoproject.com/ticket/33491#comment:5>
* owner: Yash Singhal => (none)
* status: assigned => new
--
Ticket URL: <https://code.djangoproject.com/ticket/33491#comment:6>
* cc: Marcelo Galigniana (added)
--
Ticket URL: <https://code.djangoproject.com/ticket/33491#comment:5>
* owner: nobody => Marcelo Galigniana
* status: new => assigned
--
Ticket URL: <https://code.djangoproject.com/ticket/33491#comment:6>
* has_patch: 0 => 1
Comment:
[https://github.com/django/django/pull/15938 PR]
--
Ticket URL: <https://code.djangoproject.com/ticket/33491#comment:7>
* needs_better_patch: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/33491#comment:8>
* needs_better_patch: 1 => 0
--
Ticket URL: <https://code.djangoproject.com/ticket/33491#comment:9>
* stage: Accepted => Ready for checkin
--
Ticket URL: <https://code.djangoproject.com/ticket/33491#comment:10>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"0aa2f16e63887d6053f6fd0da19254fc74c750ae" 0aa2f16e]:
{{{
#!CommitTicketReference repository=""
revision="0aa2f16e63887d6053f6fd0da19254fc74c750ae"
Fixed #33491 -- Fixed change-list selected row-highlight on cancelled
delete.
Selected rows where not highlighted when returning to the change-list
after clicking "No, take me back" on the deletion confirmation page.
This commit uses the CSS :has() pseudo-class to apply the highlight
without requiring the .selected class, which is added by JavaScript
on the click event.
Once all supported browsers have :has() available, the .selected
selector and the JavaScript to add the class can be removed.
Co-authored-by: Carlton Gibson <carlton...@noumenal.es>
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/33491#comment:11>
Comment (by Carlton Gibson <carlton@…>):
In [changeset:"e1056ed5a2004a6cd3a345eda5522abd9e1efb3d" e1056ed5]:
{{{
#!CommitTicketReference repository=""
revision="e1056ed5a2004a6cd3a345eda5522abd9e1efb3d"
Refs #33491 -- Split CSS selected-row highlight selectors.
Combined selectors break the whole rule where :has() is not supported,
for example on Firefox.
Thanks to Marcelo Galigniana for the report.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/33491#comment:12>