mdn / mdn/fred

Examples/Try it inherits the font color from browser prefs

Open
#975 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

a11y
Dominant language
JavaScript
Stars
233
Forks
61
Avg merge
1d 1h
Merged PRs (30d)
82

Description

Summary

If user changes font color in the browser settings, the text in the examples will also change it, but the background will remain white. This can cause contrast issues.

URL

Any page with Examples section, e.g:
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#examples
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meter#examples

Reproduction steps
  1. Go to about:config,
  2. Change the value of;
    • browser.anchor_color to #ff0000,
    • browser.visited_color to #00ff00,
    • browser.display.foreground_color to #ffffff,
    • browser.display.background_color to #000000,
  3. Go to;
  4. See red/lime links and white text on white background.
Expected behavior

Links and text shouldn't change color based on these prefs.

Actual behavior

Links and text change color depending on these prefs.

Device

Desktop

Browser

Firefox

Browser version

Pre-release (e.g. Beta, Nightly or Canary)

Operating system

Linux

Screenshot

Example video with browser.anchor_color. From the first URL.

https://user-images.githubusercontent.com/87250374/165396032-5c76e841-ee8a-427f-a145-6e16229eace4.mp4

Example screenshot with browser.display.foreground_color = #ffffff. Only the selected part of the text is visible. From the second URL.

image

Anything else?

The Try it boxes have a similar problem only with links. Should this be a new bug report?

Validations

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue on the Examples pages for the HTML a and meter elements using the listed Firefox about:config color preferences. Start by tracing the Examples and Try it sections in the frontend; done means their text and links retain readable colors instead of inheriting browser preferences, with the reported contrast issue no longer visible.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend, web-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.