Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adapt FilterNavigatorBar to High Contrast Mode. #5257

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions res/img/svg/scope-bar-separator-hcm-dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions res/img/svg/scope-bar-separator-hcm-light.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions src/components/app/ProfileFilterNavigator.css
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
margin: 5px 5px 0;
color: var(--internal-selected-color);
content: '';

/* opt-out of forced color so the arrow is visible */
forced-color-adjust: none;
inset-block-start: 4px;
inset-inline-start: 4px;
}
Expand All @@ -29,3 +32,13 @@ span.profileFilterNavigator--tab-selector::before {
/* Disabled tab selector indicates this with a grayed out arrow. */
color: var(--grey-30);
}

@media (forced-colors: active) {
.profileFilterNavigator--tab-selector::before {
color: currentcolor;
}

span.profileFilterNavigator--tab-selector::before {
color: GrayText;
}
}
75 changes: 69 additions & 6 deletions src/components/shared/FilterNavigatorBar.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,13 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

.filterNavigatorBar {
--internal-background-color: transparent;
--internal-hover-background-color: rgb(0 0 0 / 0.1);
--internal-hover-color: inherit;
--internal-active-background-color: rgb(0 0 0 / 0.2);
--internal-selected-background-color: transparent;
--internal-selected-color: var(--selected-color, var(--blue-60));
--internal-separator-img: url(../../../res/img/svg/scope-bar-separator.svg);

display: flex;
height: 24px;
Expand All @@ -28,6 +34,11 @@
border-width: 0 8px 0 6px;
border-right-color: transparent !important;
background-clip: padding-box;
background-color: var(--internal-background-color);

/* Make sur the design also works in High Contrast Mode. The colors are overriden
in the forced colors media query. */
forced-color-adjust: none;
line-height: 24px;
transition:
opacity 250ms var(--animation-curve),
Expand Down Expand Up @@ -88,7 +99,7 @@

.filterNavigatorBarItem:not(.filterNavigatorBarLeafItem)::after {
animation: fadeIn 250ms var(--animation-curve);
background-image: url(../../../res/img/svg/scope-bar-separator.svg);
background-image: var(--internal-separator-img);
background-position: -18px -12px;
background-repeat: no-repeat;
background-size: 24px 24px;
Expand All @@ -104,33 +115,48 @@
}
}

.filterNavigatorBarSelectedItem {
.filterNavigatorBarItem:not(
.filterNavigatorBarRootItem,
.filterNavigatorBarLeafItem
)::before,
.filterNavigatorBarItem:not(.filterNavigatorBarLeafItem)::after {
border-color: var(--internal-background-color);
}

.filterNavigatorBarItem.filterNavigatorBarSelectedItem {
background-color: var(--internal-selected-background-color);
color: var(--internal-selected-color);
}

.filterNavigatorBarSelectedItem:not(.filterNavigatorBarRootItem)::before,
.filterNavigatorBarSelectedItem:not(:first-of-type:last-of-type)::after {
border-color: var(--internal-selected-background-color);
}

.filterNavigatorBarItem:not(.filterNavigatorBarLeafItem):hover,
.filterNavigatorBarItem:has(button.profileFilterNavigator--tab-selector):hover {
background-color: rgb(0 0 0 / 0.1);
background-color: var(--internal-hover-background-color);
color: var(--internal-hover-color);
}

.filterNavigatorBarItem:not(
.filterNavigatorBarRootItem,
.filterNavigatorBarLeafItem
):hover::before,
.filterNavigatorBarItem:not(.filterNavigatorBarLeafItem):hover::after {
border-color: rgb(0 0 0 / 0.1);
border-color: var(--internal-hover-background-color);
}

.filterNavigatorBarItem:not(.filterNavigatorBarLeafItem):active:hover {
background-color: rgb(0 0 0 / 0.2);
background-color: var(--internal-hover-background-color);
}

.filterNavigatorBarItem:not(
.filterNavigatorBarRootItem,
.filterNavigatorBarLeafItem
):active:hover::before,
.filterNavigatorBarItem:not(.filterNavigatorBarLeafItem):active:hover::after {
border-color: rgb(0 0 0 / 0.2);
border-color: var(--internal-hover-background-color);
}

.filterNavigatorBarUncommittedItem {
Expand Down Expand Up @@ -176,3 +202,40 @@
transition: none;
}
}

@media (forced-colors: active) {
.filterNavigatorBar {
--internal-background-color: ButtonFace;
--internal-hover-background-color: SelectedItemText;
--internal-hover-color: SelectedItem;
--internal-active-background-color: SelectedItemText;
--internal-selected-background-color: SelectedItem;
--internal-selected-color: SelectedItemText;
--internal-separator-img: url(../../../res/img/svg/scope-bar-separator-hcm-light.svg);
}

.filterNavigatorBarItem {
color: ButtonText;
}

/* When the tab selector is active, we want the item to look like a button */
.filterNavigatorBarSelectedItem:has(
button.profileFilterNavigator--tab-selector
) {
background-color: ButtonFace;
color: ButtonText;
}

/* In regular mode, the opacity is tweaked, which isn't suited for High Contrast Mode.
Here we want the full opacity and a gray text */
.filterNavigatorBarUncommittedItem {
color: GrayText;
opacity: 1;
}

@media (prefers-color-scheme: dark) {
.filterNavigatorBar {
--internal-separator-img: url(../../../res/img/svg/scope-bar-separator-hcm-dark.svg);
}
}
}