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

fix: Left nav lacks clear tab or focus indicators with Windows HC modes #7311

Open
wants to merge 20 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 12 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
9 changes: 9 additions & 0 deletions src/DetailsView/components/base-left-nav.scss
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@
a,
button {
background-color: $nav-link-selected !important;

@media (forced-colors: active) {
forced-color-adjust: none;
background-color: Highlight !important;
}
}
}

Expand All @@ -36,6 +41,10 @@
a,
button {
background-color: $nav-link-hover;

@media (forced-colors: active) {
background-color: Highlight !important;
}
}
}
}
Expand Down
16 changes: 14 additions & 2 deletions src/DetailsView/components/left-nav/common-left-nav-link.scss
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,19 @@
color: $always-black;
}

.link-icon {
font-size: 24px;
@media (forced-colors: active) {
:global(.is-selected) & {
forced-color-adjust: none;
color: HighlightText;
}

:global(.ms-Nav-compositeLink):hover & {
forced-color-adjust: none;
color: HighlightText !important;
}

.link-icon {
font-size: 24px;
}
}
}
19 changes: 10 additions & 9 deletions src/DetailsView/components/left-nav/details-view-left-nav.scss
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@
height: calc(100vh - (#{$details-view-header-bar-height}));

:global {
.left-nav-icon {
color: $neutral-60;
}

.ms-Nav-groupContent {
margin-bottom: 0;
}
Expand Down Expand Up @@ -48,7 +44,6 @@
}

.overview-percent {
color: $neutral-55;
line-height: 16px;
font-size: 12px;
}
Expand All @@ -64,10 +59,6 @@
border-bottom: 0;
}

.ms-Button-label {
color: $neutral-100;
}

&.is-selected {
.ms-Button-label {
color: $always-black;
Expand All @@ -80,10 +71,20 @@
.ms-Button-label,
.overview-percent {
color: $highlighted-text;

@media (forced-colors: active) {
forced-color-adjust: none;
color: HighlightText !important;
}
}

.left-nav-icon {
color: $left-nav-icon;

@media (forced-colors: active) {
forced-color-adjust: none;
color: HighlightText !important;
}
}
}

Expand Down
11 changes: 11 additions & 0 deletions src/DetailsView/components/left-nav/left-nav-icon.scss
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,15 @@
background: $index-circle-background;
border-color: $neutral-0;
}

@media (forced-colors: active) {
li :global(.is-expanded) &,
:global(.ms-Nav-compositeLink):hover &,
:global(.ms-Nav-compositeLink.is-selected) & {
forced-color-adjust: none;
background-color: ButtonFace !important;
color: ButtonText !important;
border-color: ButtonText !important;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,15 @@

&:hover {
color: $link-hover;
text-decoration: underline;
}

@media screen and (forced-colors: active) {
color: linktext;

&:hover {
color: linktext;
color: ButtonText !important;
text-decoration: underline;
}
}
}
Expand Down
17 changes: 17 additions & 0 deletions src/common/components/new-tab-link-with-tooltip.scss
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,25 @@
.insights-link {
display: flex;

&:hover,
&:active {
text-decoration: underline !important;
}
}

.insights-link-icon {
display: flex;

&:hover,
&:active {
text-decoration: none !important;
}
}

@media screen and (forced-colors: active) {
.insights-link:hover,
.insights-link-icon:hover {
forced-color-adjust: none;
color: ButtonText !important;
}
}
12 changes: 9 additions & 3 deletions src/common/components/new-tab-link-with-tooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,15 @@ import * as React from 'react';
import { NamedFC } from '../react/named-fc';
import styles from './new-tab-link-with-tooltip.scss';

export type NewTabLinkWithTooltipProps = ILinkProps & { tooltipContent: string | undefined };
export type NewTabLinkWithTooltipProps = ILinkProps & {
tooltipContent: string | undefined;
className?: string | undefined;
SaanicaG marked this conversation as resolved.
Show resolved Hide resolved
};

export const NewTabLinkWithTooltip = NamedFC<NewTabLinkWithTooltipProps>(
'NewTabLinkWithTooltip',
props => {
const { tooltipContent, ...linkProps } = props;
const { tooltipContent, className, ...linkProps } = props;
const hostStyles: Partial<ITooltipHostStyles> = {
root: styles.insightsTooltipHost,
};
Expand All @@ -23,7 +26,10 @@ export const NewTabLinkWithTooltip = NamedFC<NewTabLinkWithTooltipProps>(
};
return (
<TooltipHost content={tooltipContent} styles={hostStyles} calloutProps={calloutProps}>
<NewTabLink className={styles.insightsLink} {...linkProps} />
<NewTabLink
className={typeof className === 'undefined' ? styles.insightsLink : className}
SaanicaG marked this conversation as resolved.
Show resolved Hide resolved
{...linkProps}
/>
</TooltipHost>
);
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ exports[`ContentLink renders from content, only have the icon 1`] = `
<DocumentFragment>
<mock-newtablinkwithtooltip
aria-label="Guidance"
classname="insightsLinkIcon"
href="/insights.html#/content/for/testing"
tooltipcontent="Guidance"
>
Expand All @@ -20,6 +21,7 @@ exports[`ContentLink renders from path, only have the icon 1`] = `
<DocumentFragment>
<mock-newtablinkwithtooltip
aria-label="Guidance"
classname="insightsLinkIcon"
href="/insights.html#/content/for/testing"
tooltipcontent="Guidance"
>
Expand All @@ -34,6 +36,7 @@ exports[`ContentLink renders with both text and icon 1`] = `
<DocumentFragment>
<mock-newtablinkwithtooltip
aria-label="test guidance"
classname="insightsLinkIcon"
href="/insights.html#/content/for/testing"
tooltipcontent="Guidance"
>
Expand All @@ -49,6 +52,7 @@ exports[`ContentLink renders with only text 1`] = `
<DocumentFragment>
<mock-newtablinkwithtooltip
aria-label="test guidance"
classname="insightsLinkIcon"
href="/insights.html#/content/for/testing"
tooltipcontent="Guidance"
>
Expand Down
2 changes: 2 additions & 0 deletions src/views/content/content-link.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import { Icon } from '@fluentui/react';
import { NewTabLink } from 'common/components/new-tab-link';
import { NewTabLinkWithTooltip } from 'common/components/new-tab-link-with-tooltip';
import styles from 'common/components/new-tab-link-with-tooltip.scss';
import * as React from 'react';

import { ContentActionMessageCreator } from '../../common/message-creators/content-action-message-creator';
Expand Down Expand Up @@ -52,6 +53,7 @@ export const ContentLink = NamedFC<ContentLinkProps>(
onClick={handleLinkClick}
tooltipContent={'Guidance'}
aria-label={ariaLabel}
className={styles.insightsLinkIcon}
>
{icon}
{linkText}
Expand Down
Loading