Opened 7 months ago

Closed 10 days ago

#36513 closed Bug (fixed)

Background color for admin's m2m multi-select "selected" rows is broken in Edge and Firefox

Reported by: cjs59 Owned by: Nilesh Pahari
Component: contrib.admin Version: 5.2
Severity: Normal Keywords: accessibility
Cc: Antoliny 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 Antoliny)

The change in https://code.djangoproject.com/ticket/35809 has made the selected item hard to read in Microsoft Edge, as it displays as white text on a yellow background when the m2m widget is not in focus. Chrome and Firefox both display it as black text on a yellow background. When the user clicks on the m2m widget, it changes to use the browser's built-in colours: white text on dark grey for Edge, and white text on blue for Chrome/Firefox.

I am attaching screenshots to show the focused and unfocused colours in both Edge and Chrome.

Adding the following to a custom CSS file fixes Edge so the unfocused widget renders the same as in Chrome:

form .aligned select option:checked {
        color: var(--body-fg);
}

Chrome focused


Chrome unfocused


Edge focused


Edge unfocused


Edge focused(dark)


Edge unfocused(dark)


Attachments (6)

Chrome-focused.png (11.7 KB ) - added by cjs59 7 months ago.
Chrome-unfocused.png (10.8 KB ) - added by cjs59 7 months ago.
Edge-focused.png (11.2 KB ) - added by cjs59 7 months ago.
Edge-unfocused.png (9.4 KB ) - added by cjs59 7 months ago.
Screenshot 2025-07-21 at 7.43.04 AM.png (41.6 KB ) - added by Antoliny 7 months ago.
Screenshot 2025-07-21 at 7.43.10 AM.png (44.1 KB ) - added by Antoliny 7 months ago.

Download all attachments as: .zip

Change History (25)

by cjs59, 7 months ago

Attachment: Chrome-focused.png added

by cjs59, 7 months ago

Attachment: Chrome-unfocused.png added

by cjs59, 7 months ago

Attachment: Edge-focused.png added

by cjs59, 7 months ago

Attachment: Edge-unfocused.png added

comment:1 by cjs59, 7 months ago

Description: modified (diff)

comment:2 by Antoliny, 7 months ago

Component: Uncategorizedcontrib.admin
Keywords: accessibility added
Triage Stage: UnreviewedAccepted

comment:3 by Antoliny, 7 months ago

Thank you for submitting the ticket.
I have replicated the issue. In the Edge browser, after clicking the m2m select button and the widget loses focus, the text color in light mode is hex: ffffff (white), resulting in a contrast ratio of 1.03 against the background color, which does not meet the WCAG AA criteria.
In dark mode, the text color is hex: 161616 (black), with a contrast ratio of 1.37 against the background, which also fails to meet the AA criteria, just like in light mode.

I think we could resolve the issue by setting a fixed text color :)

comment:4 by Antoliny, 7 months ago

Description: modified (diff)

comment:5 by Antoliny, 7 months ago

Description: modified (diff)

comment:6 by Antoliny, 7 months ago

Cc: Antoliny added

comment:7 by Chaitanya, 7 months ago

form .aligned select option:checked {
        color: var(--body-fg);
}

applying this change is fixing the issue, but are there any other things that need to be addressed...

in reply to:  7 comment:8 by Antoliny, 7 months ago

Replying to Chaitanya:

form .aligned select option:checked {
        color: var(--body-fg);
}

applying this change is fixing the issue, but are there any other things that need to be addressed...

I need to test it to be sure, but from what I can see, adding just the color should fix the issue.

comment:9 by Antoliny, 7 months ago

Easy pickings: set

comment:10 by Forrest Roudebush, 7 months ago

Owner: set to Forrest Roudebush
Status: newassigned

comment:11 by Forrest Roudebush, 7 months ago

Has patch: set

comment:12 by Sarah Boyce, 7 months ago

Patch needs improvement: set

comment:13 by Nilesh Pahari, 3 months ago

Hi! Since this has been open for a while, would it be okay if I take this on?

in reply to:  13 comment:14 by Antoliny, 3 months ago

Replying to Nilesh Pahari:

Hi! Since this has been open for a while, would it be okay if I take this on?

Yes, no problem at all :)

comment:15 by Nilesh Pahari, 2 months ago

Owner: changed from Forrest Roudebush to Nilesh Pahari

comment:17 by Jacob Walls, 2 months ago

Patch needs improvement: unset

comment:18 by Jacob Walls, 12 days ago

Summary: Background color for admin's m2m multi-select "selected" rows is broken in EdgeBackground color for admin's m2m multi-select "selected" rows is broken in Edge and Firefox
Triage Stage: AcceptedReady for checkin

comment:19 by Jacob Walls <jacobtylerwalls@…>, 10 days ago

Resolution: fixed
Status: assignedclosed

In 3dea5fe:

Fixed #36513 -- Improved text contrast for admin M2M multi-select widget.

Explicitly set the text color for the admin M2M widget to ensure
selected rows remain readable in browsers like Microsoft Edge and
Firefox when the widget was not focused.

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