question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Examples/Try it inherits the font color from browser prefs

See original GitHub issue

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

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
schalkneethlingcommented, May 2, 2022

@schalkneethling Can you tell if this is a use case that we support from an accessibility point of view?

This can help in these situations I believe: https://developer.mozilla.org/en-US/docs/Web/CSS/@media/forced-colors

Thank you for bringing this issue to our attention @674Y3r.

When setting a background color it is best practice to also set a foreground color and vice versa (in CSS). @674Y3r is it common to only set one of these when using these customization options? Do other websites handle this better? Did the version of MDN Web Docs before the redesign work correctly?

0reactions
674Y3rcommented, Nov 14, 2022

Unfortunately, depending on the case, the issue still persists. It is mostly visible with tables. Using https://developer.mozilla.org/en-US/docs/Web/HTML/Element/tr#frame_explicitly_specifying_table_content_groups as an example in Firefox Nightly.

Light site theme Dark site theme
Default values (expected) light-default dark-default
Custom values light-custom dark-custom

Default values:

  • browser.display.background_color - #FFFFFF
  • browser.display.foreground_color - #000000

Custom values:

  • browser.display.background_color - #000000
  • browser.display.foreground_color - #FFFFFF
Read more comments on GitHub >

github_iconTop Results From Across the Web

Font color in a table doesn't inherit from parent div
It seems that browser specific styles are being applied to <table> element. Is there an alternative workaround to make the content elements ...
Read more >
Change the fonts and colors websites use | Firefox Help
This article describes how to customize the way you see websites by choosing font styles and colors that will override those used by...
Read more >
Use Rems for Font Size to Respect User Preferences
Developers can change the font size of the root element ( html ) with CSS so that all elements inherit that new font...
Read more >
Outlook 2016 Overriding the Font Style - Litmus
[endif]--> <style type="text/css"> p{ margin:10px 0; padding:0; } ... color:inherit; cursor:default; text-decoration:none; } p,a,li,td,body ...
Read more >
Override Font and Color for a Table - erwin, Inc.
You can also choose to inherit, override, or harden this setting. Fill Options. Specifies the default fill color for the selected shape. Click...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found