Skip to content

Commit 080a552

Browse files
authored
Make link color meet contrast ratio requirements (microsoft#11037)
* make docs link color darker * darken the pxt-link variable color * aria-hidden for uninteractable logos, give buttons in headerbar role menuitem * make the MakeCode Arcade logo a button when interactable in the editor for a skillmap * remove posinset from skillmap infopanel activity action buttons * remove posinset from skillmap infopanel reward action buttons * bring role presentation back to the left header * make it aria hidden when not interactable
1 parent 982bcdb commit 080a552

6 files changed

Lines changed: 31 additions & 33 deletions

File tree

‎react-common/styles/theming/base-theme.less‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
--pxt-neutral-alpha50: rgba(0, 0, 0, 0.5);
6868
--pxt-neutral-alpha80: rgba(0, 0, 0, 0.8);
6969

70-
--pxt-link: #3977B4;
70+
--pxt-link: #3671AB;
7171
--pxt-link-hover: #204467;
7272
--pxt-focus-border: #0078D4;
7373

‎skillmap/src/App.css‎

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,14 @@ code {
9292
font-size: 1.5rem;
9393
user-select: none;
9494
display: flex;
95+
align-items: center;
96+
height: 100%;
9597
}
9698

97-
.header .brand:before {
99+
.header .header-logo:after {
98100
position: relative;
99101
height: 1.5rem;
100-
border-left: 2px solid var(--pxt-header-foreground);
102+
border-right: 2px solid var(--pxt-header-foreground);
101103
content: " ";
102104
}
103105

@@ -107,11 +109,15 @@ code {
107109
color: var(--pxt-header-background);
108110
}
109111

110-
.ui.item.logo .name {
112+
.ui.item.logo span.name {
111113
margin-left: 1rem;
112114
margin-bottom: 1px;
113115
}
114116

117+
.ui.item.logo button.name,button.name-short {
118+
margin-left: 0 !important;
119+
}
120+
115121
.header-logo img {
116122
height: 1.4rem;
117123
margin: 0 1rem;

‎skillmap/src/components/ActivityActions.tsx‎

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -98,18 +98,11 @@ export class ActivityActionsImpl extends React.Component<ActivityActionsProps> {
9898
if (status === "locked") return <div />
9999
const showSignIn = pxt.auth.hasIdentity() && !signedIn;
100100

101-
let numberOfActions = 1;
102-
if (activityStarted) numberOfActions += 2;
103-
if (completedHeaderId) numberOfActions += 1;
104-
if (showSignIn) numberOfActions += 1;
105-
106101
// Apply "grid" class when there are four actions (for a completed activity)
107102
return <div className={`actions ${completedHeaderId ? "grid" : ""}`}>
108103
<Button
109104
className="tertiary"
110105
tabIndex={-1}
111-
ariaPosInSet={1}
112-
ariaSetSize={numberOfActions}
113106
title={this.getActivityActionText()}
114107
label={this.getActivityActionText()}
115108
onClick={this.handleActionButtonClick}
@@ -118,17 +111,13 @@ export class ActivityActionsImpl extends React.Component<ActivityActionsProps> {
118111
<Button
119112
className="primary inverted"
120113
tabIndex={-1}
121-
ariaPosInSet={2}
122-
ariaSetSize={numberOfActions}
123114
title={lf("Restart")}
124115
label={lf("Restart")}
125116
onClick={this.handleRestartButtonClick}
126117
/>
127118
<Button
128119
className="primary inverted"
129120
tabIndex={-1}
130-
ariaPosInSet={3}
131-
ariaSetSize={numberOfActions}
132121
title={lf("Share")}
133122
label={lf("Share")}
134123
onClick={this.handleShareButtonClick}
@@ -137,8 +126,6 @@ export class ActivityActionsImpl extends React.Component<ActivityActionsProps> {
137126
{completedHeaderId &&
138127
<Button
139128
tabIndex={-1}
140-
ariaPosInSet={activityStarted ? 4 : 2}
141-
ariaSetSize={numberOfActions}
142129
className="primary inverted"
143130
title={lf("Save to My Projects")}
144131
label={lf("Save to My Projects")}
@@ -148,8 +135,6 @@ export class ActivityActionsImpl extends React.Component<ActivityActionsProps> {
148135
{showSignIn &&
149136
<Button
150137
tabIndex={-1}
151-
ariaPosInSet={numberOfActions}
152-
ariaSetSize={numberOfActions}
153138
className="primary inverted"
154139
onClick={dispatchShowLoginModal}
155140
label={lf("Sign in to Save")}

‎skillmap/src/components/HeaderBar.tsx‎

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ export class HeaderBarImpl extends React.Component<HeaderBarProps> {
106106

107107
protected getOrganizationLogo(targetTheme: pxt.AppTheme) {
108108
const logoUrl = targetTheme.organizationWideLogo;
109-
return <div className="header-logo">
109+
return <div className="header-logo" aria-hidden="true">
110110
{logoUrl
111111
? <img src={isLocal() ? `./assets/${logoUrl}`: logoUrl} alt={lf("{0} Logo", targetTheme.organization)}/>
112112
: <span className="name">{targetTheme.organization}</span>}
@@ -115,10 +115,23 @@ export class HeaderBarImpl extends React.Component<HeaderBarProps> {
115115

116116
protected getTargetLogo(targetTheme: pxt.AppTheme) {
117117
const { activityOpen } = this.props;
118-
return <div className={`ui item logo brand ${!activityOpen ? "noclick" : ""}`}>
118+
const isInteractive = activityOpen && targetTheme.useTextLogo;
119+
120+
return <div className={`ui item logo brand ${!activityOpen ? "noclick" : ""}`} aria-hidden={!isInteractive}>
119121
{targetTheme.useTextLogo
120-
? [<span className="name" key="org-name" onClick={this.onBackClicked}>{targetTheme.organizationText}</span>,
121-
<span className="name-short" key="org-name-short" onClick={this.onBackClicked}>{targetTheme.organizationShortText || targetTheme.organizationText}</span>]
122+
? (activityOpen
123+
? [<Button className="name menu-button" key="org-name"
124+
onClick={this.onBackClicked}
125+
title={lf("MakeCode logo, return to activity selection")}
126+
ariaLabel={lf("MakeCode logo, return to activity selection")}
127+
label={targetTheme.organizationText} />,
128+
<Button className="name-short menu-button" key="org-name-short"
129+
onClick={this.onBackClicked}
130+
title={lf("MakeCode logo, return to activity selection")}
131+
ariaLabel={lf("MakeCode logo, return to activity selection")}
132+
label={targetTheme.organizationShortText || targetTheme.organizationText} />]
133+
: [<span className="name" key="org-name">{targetTheme.organizationText}</span>,
134+
<span className="name-short" key="org-name-short">{targetTheme.organizationShortText || targetTheme.organizationText}</span>])
122135
: (targetTheme.logo || targetTheme.portraitLogo
123136
? <img className="logo" src={targetTheme.logo || targetTheme.portraitLogo} alt={lf("{0} Logo", targetTheme.boardName)}/>
124137
: <span className="name"> {targetTheme.boardName}</span>)
@@ -169,7 +182,7 @@ export class HeaderBarImpl extends React.Component<HeaderBarProps> {
169182
return <div className="user-menu">
170183
{signedIn
171184
? <MenuDropdown id="profile-dropdown" items={items} label={avatarElem || initialsElem} title={lf("Profile Settings")}/>
172-
: <Button className="menu-button" rightIcon="xicon cloud-user" title={lf("Sign In")} label={lf("Sign In")} onClick={ () => {
185+
: <Button className="menu-button" role="menuitem" rightIcon="xicon cloud-user" title={lf("Sign In")} label={lf("Sign In")} onClick={ () => {
173186
pxt.tickEvent(`skillmap.usermenu.signin`);
174187
this.props.dispatchShowLoginModal();
175188
}}/>}
@@ -192,8 +205,8 @@ export class HeaderBarImpl extends React.Component<HeaderBarProps> {
192205

193206
<div className="spacer" />
194207
<div className="header-right">
195-
{ activityOpen && <Button className="menu-button" leftIcon="fas fa-arrow-left large" title={lf("Return to activity selection")} onClick={this.onBackClicked}/> }
196-
<Button className="menu-button" leftIcon="fas fa-home large" title={lf("Return to the editor homepage")} onClick={this.onHomeClicked}/>
208+
{ activityOpen && <Button className="menu-button" role="menuitem" leftIcon="fas fa-arrow-left large" title={lf("Return to activity selection")} onClick={this.onBackClicked}/> }
209+
<Button className="menu-button" role="menuitem" leftIcon="fas fa-home large" title={lf("Return to the editor homepage")} onClick={this.onHomeClicked}/>
197210
{ helpItems?.length > 0 && <MenuDropdown id="skillmap-help" title={lf("Help menu")} icon="fas fa-question-circle large" items={helpItems} />}
198211
{ settingItems?.length > 0 && <MenuDropdown id="settings-help" title={lf("Settings menu")} icon="fas fa-cog large" items={settingItems} />}
199212
{ hasIdentity && this.getUserMenu() }

‎skillmap/src/components/RewardActions.tsx‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,17 +53,13 @@ export class RewardActionsImpl extends React.Component<RewardActionsProps> {
5353
<div className="actions">
5454
<Button
5555
tabIndex={-1}
56-
ariaPosInSet={1}
57-
ariaSetSize={showSignIn ? 3 : 2}
5856
className="primary inverted"
5957
title={lf("Claim Reward")}
6058
label={lf("Claim Reward")}
6159
onClick={this.handleActionButtonClick}
6260
/>
6361
<Button
6462
tabIndex={-1}
65-
ariaPosInSet={2}
66-
ariaSetSize={showSignIn ? 3 : 2}
6763
className="primary inverted"
6864
title={lf("Play your game")}
6965
label={lf("Play your game")}
@@ -72,8 +68,6 @@ export class RewardActionsImpl extends React.Component<RewardActionsProps> {
7268
{showSignIn &&
7369
<Button
7470
tabIndex={-1}
75-
ariaPosInSet={3}
76-
ariaSetSize={3}
7771
className="tertiary"
7872
onClick={dispatchShowLoginModal}
7973
label={lf("Sign in to Save")}

‎theme/docs.less‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
@docsHeadingColor: @docsTextColor;
1414

1515
/* Link color */
16-
@docsLinkColor: #3977b4;
16+
@docsLinkColor: #3671ab;
1717

1818
/* Code segment */
1919
@docsSegmentBackgroundColor: #f7f7f7;

0 commit comments

Comments
 (0)