Opened 4 months ago

Closed 4 months ago

#36354 closed Cleanup/optimization (fixed)

Remove unneeded JS from contrib.admin password forms

Reported by: Fabian Braun Owned by: Fabian Braun
Component: contrib.admin Version: dev
Severity: Normal Keywords:
Cc: Nick Pope, Mariusz Felisiak, David Bogar Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description (last modified by Fabian Braun)

As part of ticket-34429 (https://code.djangoproject.com/ticket/34429) JS was added to the password change and user create forms to ensure that the forms run on browsers that do not support the :has() CSS selector.

By now, all major browsers support the selector. The last one not supporting it (Firefox 115 ESR - https://support.mozilla.org/en-US/kb/firefox-users-windows-7-8-and-81-moving-extended-support#:~:text=Mozilla%20is%20providing%20critical%20security,supported%20version%20of%20Microsoft%20Windows.) is reaching end-of support in August 2025, i.e. before the next major Django release.

(See discussion here: https://github.com/django/django/pull/16942/files#r1427864863)

Steps to solve the issue:

  • Remove admin/js/unusable_password_field.js
  • Update admin/auth/user/chamge_password.html and admin/auth/user/add_form.html to not load the JS file

Change History (11)

comment:1 by Fabian Braun, 4 months ago

Easy pickings: set
Summary: Remove unneeded JS from contrib.adminRemove unneeded JS from contrib.admin password forms

comment:2 by Fabian Braun, 4 months ago

Description: modified (diff)

comment:3 by Sarah Boyce, 4 months ago

Cc: Nick Pope Mariusz Felisiak added
Triage Stage: UnreviewedAccepted

Based off my understanding, it is reasonable to remove the JavaScript for the 6.0 release

comment:4 by David Bogar, 4 months ago

Version: 5.2dev

Given that the most recent version to not support the :has() selector is going EOL in August, I think it should be safe to remove this in 6.0.

Updated version to dev, needs implementation.

comment:5 by David Bogar, 4 months ago

Cc: David Bogar added

comment:6 by Fabian Braun, 4 months ago

Owner: set to Fabian Braun
Status: newassigned

comment:7 by Fabian Braun, 4 months ago

Has patch: set

comment:8 by Bruno Alla, 4 months ago

Has patch: unset

I'm unsetting the flag because it's showing in the review queue because of it. However, there is no PR linked to this ticket to review.

comment:9 by Jacob Walls, 4 months ago

Has patch: set

It's here: PR. When in doubt about how to link a PR, the beige box above the comments always has hints about taking the next step in Trac.

Last edited 4 months ago by Jacob Walls (previous) (diff)

comment:10 by Natalia Bidart, 4 months ago

Triage Stage: AcceptedReady for checkin

comment:11 by nessita <124304+nessita@…>, 4 months ago

Resolution: fixed
Status: assignedclosed

In 65bbdbd:

Fixed #36354 -- Removed JavaScript workaround for browsers lacking :has() CSS support.

This branch removes the JavaScript fallback added in the admin for the
add user and change password templates/flows (Refs #34429).

Django documents suport for "modern, web standards compliant browsers".
See https://caniuse.com/css-has for info on browser support per version.

Note: See TracTickets for help on using tickets.
Back to Top