[Django] #34399: admin site: dark-mode-vars block is overwritten by extrastyles

21 views
Skip to first unread message

Django

unread,
Mar 9, 2023, 7:43:23 PM3/9/23
to django-...@googlegroups.com
#34399: admin site: dark-mode-vars block is overwritten by extrastyles
-----------------------------------------+--------------------------------
Reporter: TheFissk | Owner: nobody
Type: Bug | Status: new
Component: contrib.admin | Version: 4.1
Severity: Normal | Keywords: dark-mode-vars
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-----------------------------------------+--------------------------------
When themeing the admin site the dark-mode-vars block is overwritten by
the extrastyle block. making styling both impossible

example:

{{{
{% block extrastyle %}{{ block.super }}
<style>
:root {
--primary: red; /*will style primary red*/
}
</style>
{% endblock %}

{% block dark-mode-vars %}{{ block.super }}
<style>
:root {
--body-bg: green; /*will remain styled red in dark mode.*/
}
</style>
{% endblock %}
}}}

Also annoyingly styles applied in the "dark-mode-vars" block will leak to
lightmode if they are not protected with the media prefers-color-scheme
query.

This can be worked around by encasing the extrastyle styles in the
"prefers-color-scheme: light" query, but if this is going to remain the
behaviour the documentation should be updated to reflect it.

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

Django

unread,
Mar 13, 2023, 7:42:11 AM3/13/23
to django-...@googlegroups.com
#34399: admin site: dark-mode-vars block is overwritten by extrastyles
--------------------------------+--------------------------------------
Reporter: Timothy Fiss | Owner: nobody

Type: Bug | Status: new
Component: contrib.admin | Version: 4.1
Severity: Normal | Resolution:

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

* cc: Sarah Boyce (added)


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

Reply all
Reply to author
Forward
0 new messages