Skip to content

Keep Download button text color stable while clicking#5985

Merged
fatadel merged 2 commits intofirefox-devtools:mainfrom
fatadel:fix-download-btn-color-5948
Apr 30, 2026
Merged

Keep Download button text color stable while clicking#5985
fatadel merged 2 commits intofirefox-devtools:mainfrom
fatadel:fix-download-btn-color-5948

Conversation

@fatadel
Copy link
Copy Markdown
Contributor

@fatadel fatadel commented Apr 29, 2026

Drop the global a:active rule. It styled every anchor red while clicked, including ones styled as
buttons (e.g. the Download button rendered via BlobUrlLink). Introduced in #5740. Removing it lets anchors keep whatever color their wrapping class sets, avoiding the same trap for any future link-styled element.

Before

Profile

image

After

Profile

image

Fixes #5948

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 29, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.34%. Comparing base (b868d0e) to head (5a569bb).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #5985   +/-   ##
=======================================
  Coverage   85.34%   85.34%           
=======================================
  Files         318      318           
  Lines       31922    31922           
  Branches     8834     8745   -89     
=======================================
  Hits        27244    27244           
  Misses       4246     4246           
  Partials      432      432           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@fatadel fatadel requested a review from canova April 29, 2026 16:51
@canova
Copy link
Copy Markdown
Member

canova commented Apr 30, 2026

Looks reasonable to me, but did you manage to figure out why this started to happen after the dark mode? Because I remember seeing this issue in a few more places. For example, the latest one I remember was when I clicked a profile inside https://profiler.firefox.com/uploaded-recordings/ . But then I came back to reproduce it again and I couldn't.. I donno exactly what's going on and it would be good to figure it out.

@fatadel
Copy link
Copy Markdown
Contributor Author

fatadel commented Apr 30, 2026

The root cause is concrete and the same mechanism explains the uploaded-recordings flash too:

What changed. PR #5740 (dark mode) added these to res/css/global.css:

a              { color: var(--link-foreground-color); }
a:visited      { color: var(--link-visited-foreground-color); }
a:active       { color: var(--link-active-foreground-color); }   /* this is the culprit */

Before that PR there was no global a:active rule, so anchors used whatever color their button-like wrapper class set.

Why it shows up on the Download button. BlobUrlLink renders an <a>. .photon-button has specificity (0,1,0); a:active has (0,1,1) and wins, so the text turns the active-link color while the mouse button is held. My patch adds a.photon-button:active (0,2,1) to override.

The general shape of the regression. Any place we use an <a> and then style it to look like something other than a default link is now vulnerable, because the new global rules style every anchor unconditionally.

@canova
Copy link
Copy Markdown
Member

canova commented Apr 30, 2026

Oh, thanks for finding that! Hmmm. I'm leaning towards just removing that a:active rule all together. We didn't have one before, and I don't think anyone complained. It is nice to have an active color only if the link is a pure link without special css. But I don't think that's worth keeping just for that. Otherwise all the other links that we have or we will add in the future will have this issue and will need special handling.

It styled every anchor red while clicked, including ones styled as
buttons (e.g. the Download button rendered via BlobUrlLink). Introduced
in firefox-devtools#5740. Removing it lets anchors keep whatever color their wrapping
class sets, avoiding the same trap for any future link-styled element.

Fixes firefox-devtools#5948
@fatadel fatadel force-pushed the fix-download-btn-color-5948 branch from 3cb4aa6 to c459b0a Compare April 30, 2026 12:30
@fatadel
Copy link
Copy Markdown
Contributor Author

fatadel commented Apr 30, 2026

Oh, thanks for finding that! Hmmm. I'm leaning towards just removing that a:active rule all together. We didn't have one before, and I don't think anyone complained. It is nice to have an active color only if the link is a pure link without special css. But I don't think that's worth keeping just for that. Otherwise all the other links that we have or we will add in the future will have this issue and will need special handling.

Agree! Re-pushed 😊

Copy link
Copy Markdown
Member

@canova canova left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, thanks! Did some manual testing in a bunch of place and I don't see anywhere broken/bad.

@fatadel fatadel merged commit 9cc0d28 into firefox-devtools:main Apr 30, 2026
21 checks passed
@fatadel fatadel deleted the fix-download-btn-color-5948 branch April 30, 2026 15:19
@canova canova mentioned this pull request May 7, 2026
canova added a commit that referenced this pull request May 7, 2026
Changes:

[Markus Stange] Use custom splitter component (#4606)
[fatadel] Fix Download button text color when clicked (#5985)
[Samuel Glauser] Fix fullscreen icon size in bottom box (#5987)
[Nazım Can Altınova] Add `profiler-cli` for querying profiles (#5963)
[Nazım Can Altınova] Bump profiler cli version to 0.1.0 (#5996)
[Markus Stange] Switch from max-height to maxHeight in JSX
style={{...}}. (#5990)
[carverdamien] Fix comment about how time and duration are stored
(#5997)
[Nazım Can Altınova] Do not show console error when libnames are failed
to parse as a URL (#5993)
[Nazım Can Altınova] Fix the unnecessary stringify of Uint8Array
contents during zip profile extraction (#6004)


And special thanks to our localizers:

en-CA: chutten
en-CA: Saurabh
en-GB: Ian Neal
es-CL: ravmn
fy-NL: Fjoerfoks
ia: Melo46
nl: Mark Heijl
ru: Valery Ledovskoy
sv-SE: Andreas Pettersson
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Download button active state has incorrect font color

2 participants