summaryrefslogtreecommitdiff
path: root/django/contrib/admin/static
diff options
context:
space:
mode:
authorFlorian Perucki <florian.perucki@silvr.co>2022-09-23 15:51:30 +0200
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2022-09-24 14:26:54 +0100
commit2c7c22f94dc51b8b48a1590ba6d6d4b28fdcab82 (patch)
tree0e4621232c492020de6f8336feb00416a923e3eb /django/contrib/admin/static
parent0f31d10c7cf94318395f51d2613297acf1970e69 (diff)
downloaddjango-2c7c22f94dc51b8b48a1590ba6d6d4b28fdcab82.tar.gz
Fixed #34033 -- Improved accessibility of switch button for dark mode in the admin.
Bug in bc7aa2a5e91cf65fc7510edaf1776528c7ad07b4. Thanks Thibaud Colas for the report and review.
Diffstat (limited to 'django/contrib/admin/static')
-rw-r--r--django/contrib/admin/static/admin/css/dark_mode.css20
1 files changed, 20 insertions, 0 deletions
diff --git a/django/contrib/admin/static/admin/css/dark_mode.css b/django/contrib/admin/static/admin/css/dark_mode.css
index 7407447398..b899a420d4 100644
--- a/django/contrib/admin/static/admin/css/dark_mode.css
+++ b/django/contrib/admin/static/admin/css/dark_mode.css
@@ -83,6 +83,26 @@ html[data-theme="dark"] {
display: none;
}
+/*
+Fully hide screen reader text so we only show the one matching the current
+theme.
+*/
+.theme-toggle .visually-hidden {
+ display: none;
+}
+
+html[data-theme="auto"] .theme-toggle .theme-label-when-auto {
+ display: block;
+}
+
+html[data-theme="dark"] .theme-toggle .theme-label-when-dark {
+ display: block;
+}
+
+html[data-theme="light"] .theme-toggle .theme-label-when-light {
+ display: block;
+}
+
/* ICONS */
.theme-toggle svg.theme-icon-when-auto,
.theme-toggle svg.theme-icon-when-dark,