[Django] #33386: Autocomplete on refresh with Firefox interacts badly with ModelMultipleChoiceField in forms

14 views
Skip to first unread message

Django

unread,
Dec 27, 2021, 7:57:06 AM12/27/21
to django-...@googlegroups.com
#33386: Autocomplete on refresh with Firefox interacts badly with
ModelMultipleChoiceField in forms
-----------------------------------------+-------------------------
Reporter: pbrenna | Owner: nobody
Type: Uncategorized | Status: new
Component: Forms | Version: 3.2
Severity: Normal | Keywords: firefox
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 1 |
-----------------------------------------+-------------------------
Steps to reproduce:

- visit a form containing a ModelMultipleChoiceField (such as the page for
editing an auth.group in django admin) with a recent version of Firefox.
The widget has two <select>s, and the second one contains the chosen
elements.
- refresh the page with f5 or the reload button
- notice that the second <select> is now empty (no <option>s)

This causes inadvertent data loss when the user then submits the form. The
behaviour can be avoided by setting autocomplete="off".

A similar behaviour is noticeable in normal <select> widgets, where the
value chosen before refreshing is still selected after the refresh,
regardless of the <option> selected="" attribute, although this being a
bug is debatable, and certainly not limited to django.

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

Django

unread,
Dec 27, 2021, 2:54:58 PM12/27/21
to django-...@googlegroups.com
#33386: Autocomplete on refresh with Firefox interacts badly with
ModelMultipleChoiceField in forms
-------------------------------+------------------------------------
Reporter: Pietro Brenna | Owner: nobody
Type: Bug | Status: new
Component: Forms | Version: 3.2
Severity: Normal | Resolution:
Keywords: firefox | 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):

* type: Uncategorized => Bug
* stage: Unreviewed => Accepted


Comment:

Thanks for the report, I was able to reproduce this issue.

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

Django

unread,
Dec 28, 2021, 3:49:23 PM12/28/21
to django-...@googlegroups.com
#33386: Autocomplete on refresh with Firefox interacts badly with
ModelMultipleChoiceField in forms
-------------------------------+------------------------------------
Reporter: Pietro Brenna | Owner: nobody
Type: Bug | Status: new
Component: Forms | Version: 3.2

Severity: Normal | Resolution:
Keywords: firefox | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 1
-------------------------------+------------------------------------

Comment (by Dlis):

Unfortunately, Firefox has a "feature" that is associated with restoring
the values of form fields. Sometimes, this behavior does not interact well
with hidden fields like fields with CSRF-tokens. For example, a
corresponding ticket was created more than 20 years ago
(https://bugzilla.mozilla.org/show_bug.cgi?id=46845 ) and opens again from
time to time.

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

Django

unread,
Dec 20, 2022, 12:41:52 AM12/20/22
to django-...@googlegroups.com
#33386: Autocomplete on refresh with Firefox interacts badly with
ModelMultipleChoiceField in forms
-------------------------------+------------------------------------------
Reporter: Pietro Brenna | Owner: baravkareknath
Type: Bug | Status: assigned
Component: Forms | Version: 3.2

Severity: Normal | Resolution:
Keywords: firefox | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 1
-------------------------------+------------------------------------------
Changes (by baravkareknath):

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


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

Django

unread,
Dec 26, 2022, 12:50:56 AM12/26/22
to django-...@googlegroups.com
#33386: Autocomplete on refresh with Firefox interacts badly with
ModelMultipleChoiceField in forms
-------------------------------------+-------------------------------------
Reporter: Pietro Brenna | Owner: Eknath
| Baravkar
Type: Bug | Status: assigned
Component: Forms | Version: 3.2
Severity: Normal | Resolution:
Keywords: firefox | Triage Stage: Ready for
| checkin

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

* stage: Accepted => Ready for checkin


Comment:

we can disable autocomplete field in python django as below:

hidden_widget = MultipleHiddenInput(attrs={'autocomplete': 'off'})
widget = SelectMultiple(attrs={'autocomplete': 'off'})

As well as we have one more option to set widget-
autocomplete = False like is_localized = False, is_required = False and so
on..

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

Django

unread,
Dec 26, 2022, 2:31:22 AM12/26/22
to django-...@googlegroups.com
#33386: Autocomplete on refresh with Firefox interacts badly with
ModelMultipleChoiceField in forms
-------------------------------+-------------------------------------------

Reporter: Pietro Brenna | Owner: Eknath Baravkar
Type: Bug | Status: assigned
Component: Forms | Version: 3.2
Severity: Normal | Resolution:
Keywords: firefox | 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):

* stage: Ready for checkin => Accepted


Comment:

Eknath, this ticket doesn't have submitted and reviewed PR, please check
[https://docs.djangoproject.com/en/stable/internals/contributing/triaging-
tickets/#triage-stages "Triaging tickets"] docs.

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

Django

unread,
Dec 28, 2022, 12:14:23 AM12/28/22
to django-...@googlegroups.com
#33386: Autocomplete on refresh with Firefox interacts badly with
ModelMultipleChoiceField in forms
-------------------------------+-------------------------------------------
Reporter: Pietro Brenna | Owner: Eknath Baravkar
Type: Bug | Status: assigned
Component: Forms | Version: 3.2

Severity: Normal | Resolution:
Keywords: firefox | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 1
-------------------------------+-------------------------------------------

Comment (by Eknath Baravkar):

Hi Mariusz Felisiak, Thanks for replay. I am first time contributor; I
will work on the same.

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

Django

unread,
Jan 2, 2023, 3:04:35 AM1/2/23
to django-...@googlegroups.com
#33386: Autocomplete on refresh with Firefox interacts badly with
ModelMultipleChoiceField in forms
-------------------------------+-------------------------------------------
Reporter: Pietro Brenna | Owner: Eknath Baravkar
Type: Bug | Status: assigned
Component: Forms | Version: 3.2

Severity: Normal | Resolution:
Keywords: firefox | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

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

* has_patch: 0 => 1


Comment:

Add patch Please check PR as below:
https://github.com/django/django/pull/16418

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

Django

unread,
Jan 2, 2023, 4:19:08 AM1/2/23
to django-...@googlegroups.com
#33386: Autocomplete on refresh with Firefox interacts badly with
ModelMultipleChoiceField in forms
-------------------------------+-------------------------------------------
Reporter: Pietro Brenna | Owner: Eknath Baravkar
Type: Bug | Status: assigned
Component: Forms | Version: 3.2

Severity: Normal | Resolution:
Keywords: firefox | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 1
-------------------------------+-------------------------------------------

Comment (by Mariusz Felisiak):

I can no longer reproduce this issue on Firefox 108.0.1.

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

Django

unread,
Jan 3, 2023, 5:53:33 AM1/3/23
to django-...@googlegroups.com
#33386: Autocomplete on refresh with Firefox interacts badly with
ModelMultipleChoiceField in forms
-------------------------------+-------------------------------------------
Reporter: Pietro Brenna | Owner: Eknath Baravkar
Type: Bug | Status: closed
Component: Forms | Version: 3.2
Severity: Normal | Resolution: needsinfo

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

* status: assigned => closed
* has_patch: 1 => 0
* resolution: => needsinfo
* stage: Accepted => Unreviewed


Comment:

Closing as "needsinfo" unless someone can reproduce it with
''"[https://docs.djangoproject.com/en/dev/faq/admin/#what-browsers-are-
supported-for-using-the-admin the recent versions of modern, web standards
compliant browsers]"''.

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

Reply all
Reply to author
Forward
0 new messages