Open Bug 2048483 Opened 3 months ago Updated 7 days ago

firefox ignores userContent.css and user.js text selection highlight in background, and the green value is barely visible, vast inferior to anything in the market

Categories

(Core :: Layout: Text and Fonts, defect, P3)

Firefox 152
defect

Tracking

()

UNCONFIRMED

People

(Reporter: wwang200112, Unassigned, NeedInfo)

References

Details

Attachments

(1 obsolete file)

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:152.0) Gecko/20100101 Firefox/152.0

Steps to reproduce:

firefox ignores userContent.css and user.js text selection highlight in background, and the green value is barely visible, vast inferior to anything in the market

try this in userContent.css

@media (prefers-color-scheme: light) {
  :root {
    --color-accent-primary: #2656c9 !important;
    --color-accent-attention: #4766cb !important;
    --text-color-accent-primary-selected:#ffffff  !important;
  }
}
@media (prefers-color-scheme: dark) {
  :root {
    --color-accent-primary: #aec6f6 !important;
    --color-accent-attention: #17379d !important;
    --text-color-accent-primary-selected: #000 !important;
  }
}
::selection {
  background: var(--color-accent-primary) !important;
  background-color: var(--color-accent-primary) !important;
  color: var(--text-color-accent-primary-selected) !important;
}

var, ::selection, every single one of them is ignored.

try below in user.js

user_pref("ui.textSelectBackground", "#4766cb");

it's again ignored

Actual results:

nothing works except author css injected from tampermonkey

Expected results:

can mozilla do NOT override the text selection colors have those hard coded for page with dark background?

and if it must be overridden just because "think different", can mozilla use a value that provides a contrast level following w3c guideline instead of this horrible greenish tint? a barely visible color forced upon user is "thinking inferior" not "different"

The Bugbug bot thinks this bug should belong to the 'Core::Layout: Text and Fonts' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: Untriaged → Layout: Text and Fonts
Product: Firefox → Core

Hi, thanks for reporting. Could you share with us which page is giving you this green highlight?

Flags: needinfo?(wwang200112)

you can try wikipedia and github toggle light dark theme.
or, literally anything where the page in "dark mode"(whether the page does media query affect that or not)

and the light theme isn't applying the usercontent.css ::selection either. it's just the default not as bad.

Flags: needinfo?(wwang200112)

That's very strange - I was able to:

  1. Create a new profile from about:profiles
  2. Set toolkit.legacyUserProfileCustomizations.stylesheets to true in about:config
  3. Go to about:support
  4. Click "Open Directory" for "Profile Directory"
  5. Create chrome directory
  6. Create userContent.css under the new chrome directory
  7. Paste content from comment 0
  8. Restart browser with the new profile

And I can see that the selection color does indeed change to a light bluish color. Could you confirm that this works on your end? Perhaps an extension is overriding the highlight color?

The severity field is not set for this bug.
:TYLin, could you have a look please?

For more information, please visit BugBot documentation.

Flags: needinfo?(aethanyc)

Ah, so this is because these flags only look at author (not user) sheets... Maybe we should treat user rules like author rules for most purposes here, I think that'd be fine.

So... There are different things going on here.

  • First, what's your selection color? On windows text selection should always be white-on-blue generally. Can you attach a screenshot?
  • The default text selection color is changeable via ui.highlight / ui.highlighttext prefs.
  • But it should never be green? The only green we use is for find-in-page afaict.

Could you clarify / post screenshots of the behavior you get on a clean profile?

Flags: needinfo?(aethanyc) → needinfo?(wwang200112)

The new names are a bit of a mouthful but this should be fine-ish...

Would need a test, but I think I want to get to the bottom of this /
this should probably land on a separate bug.

Severity: -- → S3
Priority: -- → P3

Comment on attachment 9605050 [details]
WIP: Bug 2048483 - Allow user CSS to override native theming.

Revision D310810 was moved to bug 2075979. Setting attachment 9605050 [details] to obsolete.

Attachment #9605050 - Attachment is obsolete: true
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: