#35008: Minifiers break django contrib admins UI
-------------------------------------+-------------------------------------
Reporter: Raphaƫl | Owner: nobody
Stefanini |
Type: | Status: new
Cleanup/optimization |
Component: | Version: 4.2
contrib.admin | Keywords: UI admin minified
Severity: Normal | css
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 1
UI/UX: 1 |
-------------------------------------+-------------------------------------
I have been using a HTML minifier on django's output and it breaks some UI
elements in django's shipped admin by stripping some default attributes,
mainly by removing `type="text"` on inputs, since it is a default html
input attribute.
This affect anyone who would use a minifier either as middleware or as CDN
feature, and the logic is clear, you don't have to keep default html
attribute.
The problem is that django repo CSS rules don't take that in account and
it assume for all attributes to be present.
Django would need to have a CSS rule stating `input:not([type]),
input[type=text]` instead of just `input[type=text]` for the minified
version to match the original UI.
I have found only three places in django.contrib.admin that would need a
CSS update, so I believe it is an easy fix:
{{{
// base.css:485
input:not([type]),
...
{
border: 1px solid var(--border-color);
border-radius: 4px;
padding: 5px 6px;
margin-top: 0;
color: var(--body-fg);
background-color: var(--body-bg);
}
// base.css:495
input:not([type]):focus,
...
{
border-color: var(--body-quiet-color);
}
// responsive.css:177
.form-row input:not([type]),
...
{
box-sizing: border-box;
margin: 0;
padding: 6px 8px;
min-height: 2.25rem;
font-size: 0.875rem;
}
}}}
I create this ticket after having discussed the issue here
https://github.com/adamchainz/django-minify-html/issues/165
--
Ticket URL: <https://code.djangoproject.com/ticket/35008>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/0107018c20883db1-14a585a9-748a-433c-812e-f64e5f70267d-000000%40eu-central-1.amazonses.com.