From 0aa2f16e63887d6053f6fd0da19254fc74c750ae Mon Sep 17 00:00:00 2001 From: Marcelo Galigniana Date: Wed, 17 Aug 2022 11:04:23 +0200 Subject: [PATCH] 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 --- django/contrib/admin/static/admin/css/changelists.css | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/django/contrib/admin/static/admin/css/changelists.css b/django/contrib/admin/static/admin/css/changelists.css index 68ba55787b..aa872dcf70 100644 --- a/django/contrib/admin/static/admin/css/changelists.css +++ b/django/contrib/admin/static/admin/css/changelists.css @@ -258,7 +258,10 @@ vertical-align: baseline; } -#changelist table tbody tr.selected { +/* Once the :has() pseudo-class is supported by all browsers, the tr.selected + selector and the JS adding the class can be removed. */ +#changelist table tbody tr.selected, +#changelist table tbody tr:has(input[type=checkbox]:checked) { background-color: var(--selected-row); }