Closed Bug 1864052 Opened 2 years ago Closed 1 year ago

Increase color contrast of focus outline colors for web content

Categories

(Core :: Widget, enhancement, P3)

enhancement

Tracking

()

RESOLVED FIXED
136 Branch
Accessibility Severity s3
Tracking Status
firefox136 --- fixed

People

(Reporter: ayeddi, Assigned: emilio)

References

(Blocks 1 open bug)

Details

(Keywords: access)

Attachments

(3 files)

We want to ensure the focus outline is visible against all backgrounds for in-content UI, i.e. data:text/html,<button>Tab to me</button>.

Currently Firefox provides double outline using moz blue colors and primary button colors and accent color: inner outline is opaque and the outer is partially transparent. This does not work well against blue backgrounds and backgrounds with low color contrast with the blue.

Using two different colors for the outline - i.e. black and white as Edge does - would provide the best experience against all backgrounds. Using neutral colors would also likely to fit into the most color schemes of websites and hopefully prevent authors from removing the focus outline or replacing it with the colors that would decrease the accessibility of the focused state.

See Also: → 1864053
Component: Themes → CSS Parsing and Computation
Product: Toolkit → Core
Summary: Increase color contrast of focus outline colors for in-content UI → Increase color contrast of focus outline colors for web content

I'm confused, the default outline uses three colors for widgets, and two for regular elements. Comment 0 is not linking to the right code, the right code is here

Flags: needinfo?(ayeddi)
Attached image compare.png

Anna, Morgan, and I have been chatting about how to make the focus rings in Firefox more accessible, so I'll try to summarize what came out of it :)

What we agreed on is that it would be good to remove the 2px translucent outermost focus ring and replace it with a 1px white ring that directly surrounds the inner focus ring without a gap (see attached image). Additionally, the focus ring for links should be the same as for buttons, text areas, etc.

I think we weren't quite as clear on whether to respect the accent color. A color contrast of 7:1 or greater would be best for the ring color. But, for instance, the accent blue of macOS we're using right now has a contract of 4:1. Accent colors like purple are better with 6.2:1, but if a user selects yellow, the contrast is only 1.5:1.

As a fallback, or if we didn't use accent colors at all, we said that our blue-60 (#0250BB) would be a good choice. Morgan also mentioned that we have the "use system colors" checkbox, and if we decide not to use accent colors by default, the focus ring color should maybe still respect that setting.

Severity: -- → S3
Type: defect → enhancement
Priority: -- → P3
Flags: needinfo?(ayeddi)
See Also: → 1941755
Flags: needinfo?(emilio)

As per the UX request. This actually cleans up a bit, so that's nice.

Make the themed outline code not pre-inflate the rect that's given to
widget, so as to handle offsets in one place only.

Invert the colors for checkbox/radio as per bug 1941755 comment 2.

Assignee: nobody → emilio
Status: NEW → ASSIGNED
Flags: needinfo?(emilio)
Pushed by ealvarez@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/ae8a45ec77e8 Make native widgets use the same auto style outline. r=mstange
Pushed by emilio@crisal.io: https://hg.mozilla.org/integration/autoland/rev/d2cf74f7ddb3 Fix rendering of outline-style auto with no rounded corners and outline-offset.
Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 136 Branch
Component: CSS Parsing and Computation → Widget
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: