Re: [Django] #34696: Actions selection counter gets cleared when using Chrome's back button

27 views
Skip to first unread message

Django

unread,
Jul 7, 2023, 12:17:46 AM7/7/23
to django-...@googlegroups.com
#34696: Actions selection counter gets cleared when using Chrome's back button
--------------------------------------+------------------------------------
Reporter: Cauê Thenório | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: contrib.admin | Version: 4.2
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 1
--------------------------------------+------------------------------------
Changes (by Mariusz Felisiak):

* cc: Marcelo Galigniana (added)
* type: Bug => Cleanup/optimization
* stage: Unreviewed => Accepted


Comment:

Thanks for the report. Row selections are preserved when using browser's
"Back" in Chrome only. As far as I'm aware, this is not an intended
feature, however we should keep the counter in sync or uncheck the rows.

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

Django

unread,
Jul 7, 2023, 5:58:16 AM7/7/23
to django-...@googlegroups.com
#34696: Actions selection counter gets cleared when using Chrome's back button
--------------------------------------+------------------------------------
Reporter: Cauê Thenório | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: contrib.admin | Version: 4.2
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 1
--------------------------------------+------------------------------------

Comment (by Marcelo Galigniana):

> Row selections are preserved when using browser's "Back" in Chrome only.
As far as I'm aware, this is not an intended feature

Correct! I did a fix to force the uncheck:
https://code.djangoproject.com/ticket/33491. Seems we have a bug +
add/force the row counter reset!

Cauê Thenório, do you want to work in a patch?

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

Django

unread,
Jul 7, 2023, 7:57:15 AM7/7/23
to django-...@googlegroups.com
#34696: Actions selection counter gets cleared when using Chrome's back button
--------------------------------------+------------------------------------
Reporter: Cauê Thenório | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: contrib.admin | Version: 4.2
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 1
--------------------------------------+------------------------------------

Comment (by Cauê Thenório):

I did a test here with different browsers on MacOS:
- Chrome 113 keeps rows selected and the counter is reset ❌
- Safari 16.5 keeps rows selected and the counter is updated ✅
- Firefox 115 clear selection and the counter is updated ✅

Each browser has a different behavior but only Chrome gets the counter out
of sync.

Based on this discussion: https://github.com/django/django/pull/15938, it
looks like it was decided to keep Chrome's behavior as users may get used
to this behavior when using Chrome, and it saves user's work compared with
Firefox, where the user will need to reselect previously selected rows.

Yes Marcelo Galigniana, I would like to work on a patch. I believe it will
be a couple of the lines, to call the `updateCounter` function when the
page loads.

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

Django

unread,
Jul 7, 2023, 9:54:46 AM7/7/23
to django-...@googlegroups.com
#34696: Actions selection counter gets cleared when using Chrome's back button
--------------------------------------+------------------------------------
Reporter: Cauê Thenório | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: contrib.admin | Version: 4.2
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 1
--------------------------------------+------------------------------------

Comment (by Cauê Thenório):

After some tests, I found out that Chrome restores the selection after
`Actions(actionsEls)` is executed, therefore calling `updateCounter` in
the body of `Actions` function won't work as Chrome didn't restore the
selection at that point.

In this comment:
https://bugs.chromium.org/p/chromium/issues/detail?id=1057463#c5
A Chrome developer states the values are restored after the `pageshow`
event: https://developer.mozilla.org/en-
US/docs/Web/API/Window/pageshow_event

I'll write a patch to run ` updateCounter` when the `pageshow` event is
triggered.

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

Django

unread,
Jul 7, 2023, 10:13:47 AM7/7/23
to django-...@googlegroups.com
#34696: Actions selection counter gets cleared when using Chrome's back button
--------------------------------------+------------------------------------
Reporter: Cauê Thenório | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: contrib.admin | Version: 4.2
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 1
--------------------------------------+------------------------------------
Changes (by Cauê Thenório):

* has_patch: 0 => 1


Comment:

PR: https://github.com/django/django/pull/17052

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

Django

unread,
Jul 10, 2023, 4:13:42 AM7/10/23
to django-...@googlegroups.com
#34696: Actions selection counter gets cleared when using Chrome's back button
-------------------------------------+-------------------------------------

Reporter: Cauê Thenório | Owner: nobody
Type: | Status: new
Cleanup/optimization |

Component: contrib.admin | Version: 4.2
Severity: Normal | Resolution:
Keywords: | Triage Stage: Ready for
| checkin

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

* stage: Accepted => Ready for checkin


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

Django

unread,
Jul 10, 2023, 4:53:07 AM7/10/23
to django-...@googlegroups.com
#34696: Actions selection counter gets cleared when using Chrome's back button
-------------------------------------+-------------------------------------
Reporter: Cauê Thenório | Owner: nobody
Type: | Status: closed

Cleanup/optimization |
Component: contrib.admin | Version: 4.2
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: 0 | UI/UX: 1
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak <felisiak.mariusz@…>):

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


Comment:

In [changeset:"f7cfa48283c94018861688f17ab3935d588fbcc3" f7cfa482]:
{{{
#!CommitTicketReference repository=""
revision="f7cfa48283c94018861688f17ab3935d588fbcc3"
Fixed #34696 -- Updated selection counter in admin changelist on Chrome.
}}}

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

Reply all
Reply to author
Forward
0 new messages