Skip to content

Adapt FilterNavigatorBar to High Contrast Mode.#5257

Merged
julienw merged 2 commits into
firefox-devtools:mainfrom
nchevobbe:hcm-navigator-bar
Jan 27, 2025
Merged

Adapt FilterNavigatorBar to High Contrast Mode.#5257
julienw merged 2 commits into
firefox-devtools:mainfrom
nchevobbe:hcm-navigator-bar

Conversation

@nchevobbe

@nchevobbe nchevobbe commented Dec 11, 2024

Copy link
Copy Markdown
Member

This ensures the different items are properly rendered in HCM:

  • the items gets a button color, and have a distinct hovered style
  • the selected item looks selected
  • the separator are visible (a dark version of the existing image was added)
  • the disabled items have full opacity and use a gray text

dark light
single profile navigator button image image
single profile navigator button hovered image image
with a few items (second one hovered, last one is the "preview") image image

@codecov

codecov Bot commented Dec 11, 2024

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 86.08%. Comparing base (9175e24) to head (033a323).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #5257   +/-   ##
=======================================
  Coverage   86.08%   86.08%           
=======================================
  Files         311      311           
  Lines       29678    29678           
  Branches     8190     8190           
=======================================
  Hits        25548    25548           
  Misses       3548     3548           
  Partials      582      582           

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

@nchevobbe nchevobbe added the accessibility Related to making the profiler UI accessible label Dec 11, 2024

@julienw julienw left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks!
I only have these small comments, tell me what you think and rerequest review when you're ready :-)

Comment thread src/components/shared/FilterNavigatorBar.css Outdated
@media (forced-colors: active) {
.filterNavigatorBar {
--internal-background-color: ButtonFace;
--internal-hover-background-color: SelectedItemText;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This one doesn't work very well for me on Linux when using the Light theme: it's white, so it doesn't well stand out with the white background around. Surprisingly with the dark theme this works fine, because SelectedItem and SelectedItemText stay the same (!) and therefore stand ou just fine!

It would be good to fix that but if that not easy (and you consider it's more a bug in Linux) I'm also fine with keeping it.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Maybe using ButtonFace/ButtonText would make sense?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Could you post a screenshot of this please (with and without :hover)? So basically the issue is that SelectedItemText has the same/similar value as Canvas ? Could you check the computed values of those?
I'm using what's recommended by the accessibility team, but here the design isn't exactly the same (e.g. we don't have block borders). We could switch to using ButtonText bg and ButtonFace color, but that would make it different from other items we already have the SelectedItemText?SelectedItem pair for hover style :/

@julienw julienw Jan 17, 2025

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thinking about it more, I think I'd prefer to use the same selected values: that is SelectedItem for background and SelectedItemText for text, on hover. They'd stand out more. Currently I don't think they're very "high contrast" when hovering, not even in your screenshots.
(I'm fine to swap them for the "active" state though).

What do you think?

Screenshots with the current version:
light mode:
image

dark mode:
image

It may also be that there's a deeper issue in Firefox, where SelectedItem/SelectedItemText don't change with the dark mode (at least for me on Linux).

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Thinking about it more, I think I'd prefer to use the same selected values: that is SelectedItem for background and SelectedItemText for text, on hover. They'd stand out more. Currently I don't think they're very "high contrast" when hovering, not even in your screenshots. (I'm fine to swap them for the "active" state though).

What do you think?

That would make it hard to differentiate between hovered and selected, which isn't ideal.
At least in the screenshot you're providing the color of the text is updated, so that's something.
If we want to go bold, we could have a ButtonText background with a ButtonFace color, but it looked a tad brutal when I tried (but I think that was something Nathan suggested to me in some HCM review in DevTools, so that could work).
Would you mind trying this combination and telling me how it looks for you?

(The borders look a bit weird on your screenshots, not sure what this is about)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thinking about it more, I think I'd prefer to use the same selected values: that is SelectedItem for background and SelectedItemText for text, on hover. They'd stand out more. Currently I don't think they're very "high contrast" when hovering, not even in your screenshots. (I'm fine to swap them for the "active" state though).
What do you think?

That would make it hard to differentiate between hovered and selected, which isn't ideal.

But to me that makes it obvious what a click operation will do: this will make the current hovered one selected.

At least in the screenshot you're providing the color of the text is updated, so that's something. If we want to go bold, we could have a ButtonText background with a ButtonFace color, but it looked a tad brutal when I tried (but I think that was something Nathan suggested to me in some HCM review in DevTools, so that could work). Would you mind trying this combination and telling me how it looks for you?

I can have a look yes.

(The borders look a bit weird on your screenshots, not sure what this is about)

This happens at some zoom level because of rounding differences (I think) between borders (sticking to integer number of pixels) and other things (not sticking to integer value of pixels). I never really bothered trying to fix this.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Thinking about it more, I think I'd prefer to use the same selected values: that is SelectedItem for background and SelectedItemText for text, on hover. They'd stand out more. Currently I don't think they're very "high contrast" when hovering, not even in your screenshots. (I'm fine to swap them for the "active" state though).
What do you think?

That would make it hard to differentiate between hovered and selected, which isn't ideal.

But to me that makes it obvious what a click operation will do: this will make the current hovered one selected.

Well, it kind of does, but you can't really have the same style for 2 different states, "to be selected" and "selected" are different. Would you be okay o land this as is for now? I already used it for a few items in the profiler, as well as in DevTools, and this is the combination that is recommended by the a11y team. maybe we could report the issue on Linux to them so they would come up with something better?

(The borders look a bit weird on your screenshots, not sure what this is about)

This happens at some zoom level because of rounding differences (I think) between borders (sticking to integer number of pixels) and other things (not sticking to integer value of pixels). I never really bothered trying to fix this.

Alright, not my patch then :)

@julienw julienw Jan 27, 2025

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Well, it kind of does, but you can't really have the same style for 2 different states, "to be selected" and "selected" are different.

I don't see why not, because one of them is transient while the other one is fixed.

Would you be okay o land this as is for now? I already used it for a few items in the profiler, as well as in DevTools, and this is the combination that is recommended by the a11y team. maybe we could report the issue on Linux to them so they would come up with something better?

I'm fine with landing it as is though, this is still a huge improvement! And this concern is a bit nitpicking :-)

Comment thread src/components/shared/FilterNavigatorBar.css Outdated
This ensures the different items are properly rendered in HCM:
- the items gets a button color, and have a distinct hovered style
- the selected item looks selected
- the separator are visible (light and dark HCM-specific version of the existing image were added)
- the disabled items have full opacity and use a gray text

@julienw julienw left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

thanks!

@julienw julienw enabled auto-merge (squash) January 27, 2025 16:05
@julienw julienw merged commit ab68bda into firefox-devtools:main Jan 27, 2025
@canova canova mentioned this pull request Jan 30, 2025
canova added a commit that referenced this pull request Jan 30, 2025
Updates:

[Julien Wajsberg] Some more small refactorings (#5320)
[Markus Stange] Pass the correct sample index offset to
getTimingsForCallNodeIndex for the flame graph tooltip. (#5328)
[Nisarg Jhaveri] Update docs to include Android Studio/Simpleperf trace
file support (#5309)
[Markus Stange] Don't pass the preview filtered thread to
getTimingsForPath/CallNodeIndex. (#5329)
[Nazım Can Altınova] Add a "Sample timestamp" field to the sample
tooltip in timeline (#5322)
[Markus Stange] Reduce confusion between call tree summary strategy
aware samples and regular samples (#5330)
[Markus Stange] Rename this getCounter selector to getCounters. (#5337)
[Markus Stange] Make sample indexes compatible between the unfiltered
and (preview) filtered call tree summary strategy samples when using an
allocation strat>
[Markus Stange] Remove some code that uses the preview filtered thread
(#5336)
[Markus Stange] Remove getMarkerSchemaName special cases - look up
marker schemas from data.type and nothing else (#5293)
[Markus Stange] Remove the makeProfileSerializable step - make the raw
in-memory profile match the format that's stored in the file (#5287)
[Nicolas Chevobbe] Adapt FilterNavigatorBar to High Contrast Mode.
(#5257)
[Nicolas Chevobbe] Adapt Tracks to High Contrast Mode. (#5252)
[Markus Stange] Adjust string index fields in markers when merging
threads (#5344)
[Theodoros Nikolaou] Localize title and aria label in ProfileName
(#5345)
[Julien Wajsberg] Adapt time-slice selection in High Contrast Mode.
(#5259)
[Markus Stange] Make stackTable (sub)category derived data (#5342)
[Markus Stange] Compute cpuRatio values when computing the derived
thread (#5288)
[Nazım Can Altınova] Add a context menu item to open the JS scripts in
DevTools debugger (#5295)

Also thanks to our localizers:

el: Jim Spentzos
fr: Théo Chevalier
it: Francesco Lodolo [:flod]
zh-TW: Pin-guang Chen
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

accessibility Related to making the profiler UI accessible

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants