summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntoliny0919 <antoliny0919@gmail.com>2026-02-10 18:56:43 +0900
committerJacob Walls <jacobtylerwalls@gmail.com>2026-02-28 09:05:37 -0500
commit21664867b60a49c25cf93191a81f335a5eafca53 (patch)
tree2b8da631f58fb3c3a4b1ad6500e129c16918d488
parentb415cef5d21cd5beac212a833f9f0b7727899f64 (diff)
Fixed #36914 -- Fixed background-color to also apply to select options in TabularInline.
-rw-r--r--django/contrib/admin/static/admin/css/forms.css5
-rw-r--r--tests/admin_inlines/tests.py16
2 files changed, 20 insertions, 1 deletions
diff --git a/django/contrib/admin/static/admin/css/forms.css b/django/contrib/admin/static/admin/css/forms.css
index c474368184..0c7b8825f1 100644
--- a/django/contrib/admin/static/admin/css/forms.css
+++ b/django/contrib/admin/static/admin/css/forms.css
@@ -18,6 +18,10 @@
vertical-align: 0;
}
+.form-row select option:checked {
+ background-color: var(--selected-row);
+}
+
form .form-row p {
padding-left: 0;
}
@@ -150,7 +154,6 @@ form .aligned div.help:last-child {
}
form .aligned select option:checked {
- background-color: var(--selected-row);
color: var(--body-fg);
}
diff --git a/tests/admin_inlines/tests.py b/tests/admin_inlines/tests.py
index 50b3a7baba..eda7c91310 100644
--- a/tests/admin_inlines/tests.py
+++ b/tests/admin_inlines/tests.py
@@ -2572,3 +2572,19 @@ class SeleniumTests(AdminSeleniumTestCase):
m2m_widget = self.selenium.find_element(By.CSS_SELECTOR, "div.selector")
self.assertTrue(m2m_widget.is_displayed())
self.take_screenshot("tabular")
+
+ @screenshot_cases(["desktop_size", "mobile_size", "rtl", "dark", "high_contrast"])
+ def test_tabular_inline_m2m_widget_option_bg(self):
+ from selenium.webdriver.common.by import By
+
+ Person.objects.create(firstname="Lee")
+ self.admin_login(username="super", password="secret")
+ self.selenium.get(
+ self.live_server_url + reverse("admin:admin_inlines_courseproxy2_add")
+ )
+ selector = self.selenium.find_element(By.CSS_SELECTOR, "div.selector")
+ options = selector.find_elements(By.CSS_SELECTOR, "select option")
+ self.assertGreater(len(options), 0)
+ options[0].click()
+ selector.find_element(By.CSS_SELECTOR, "p.selector-filter input").click()
+ self.take_screenshot("focus_out")