Skip to content

Commit 2f5f7b2

Browse files
committed
Merge branch 'master' into standardize-file-names
2 parents f90d9b7 + 8c8ca7c commit 2f5f7b2

File tree

11 files changed

+131
-40
lines changed

11 files changed

+131
-40
lines changed

aries-site/src/components/content/SubsectionText.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,12 @@ const StyledBox = styled(Box)`
2121
}
2222
`;
2323

24+
const AccessibilityColorMap = accessibility => {
25+
if (accessibility.includes('Passed')) return 'status-ok';
26+
if (accessibility.includes('Failed')) return 'status-critical';
27+
return 'status-warning';
28+
};
29+
2430
export const SubsectionText = ({
2531
children,
2632
level,
@@ -37,7 +43,7 @@ export const SubsectionText = ({
3743
{accessibility && (
3844
<Tag
3945
alignSelf="start"
40-
border={{ color: 'brand' }}
46+
border={{ color: AccessibilityColorMap(accessibility) }}
4147
value={accessibility}
4248
onClick={() =>
4349
document

aries-site/src/data/structures/components.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import { TagPreview } from '../../examples/cardPreviews/tag';
3030
export const components = [
3131
{
3232
name: 'Anchor',
33-
accessibility: 'Passed WCAG 2.2 AAA',
33+
accessibility: 'Passed WCAG 2.2 AA',
3434
category: 'Controls',
3535
description:
3636
'Hyperlinks used with text-based navigation, such as inline text.',
@@ -90,6 +90,7 @@ export const components = [
9090
},
9191
{
9292
name: 'Button',
93+
accessibility: 'Passed WCAG 2.2 AA',
9394
category: 'Controls',
9495
description:
9596
'Buttons are graphic elements that indicate to users that actions can be performed.',
@@ -850,6 +851,7 @@ export const components = [
850851
},
851852
{
852853
name: 'Menu',
854+
accessibility: 'Failed WCAG 2.2 AA',
853855
category: 'Controls',
854856
description:
855857
'Menu is a component that contains a list of actions. When a user clicks an item in the menu, the menu closes and the action is executed.',

aries-site/src/data/wcag/components.json

+36-1
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,50 @@
22
{
33
"anchor": [
44
{ "rule": "1.4.1", "status": "passed" },
5-
{ "rule": "1.4.6", "status": "passed" },
65
{ "rule": "1.4.3", "status": "passed" },
6+
{ "rule": "1.4.6", "status": "passed" },
77
{ "rule": "2.1.1", "status": "passed" },
88
{ "rule": "2.1.2", "status": "passed" },
99
{ "rule": "2.1.3", "status": "passed" },
1010
{ "rule": "2.4.4", "status": "conditional" },
1111
{ "rule": "2.4.7", "status": "passed" },
1212
{ "rule": "2.4.9", "status": "conditional" },
13+
{ "rule": "2.4.13", "status": "failed" },
14+
{ "rule": "3.2.1", "status": "passed" },
15+
{ "rule": "4.1.2", "status": "passed" }
16+
],
17+
"button": [
18+
{ "rule": "1.1.1", "status": "conditional" },
19+
{ "rule": "1.3.1", "status": "conditional" },
20+
{ "rule": "1.3.3", "status": "conditional" },
21+
{ "rule": "1.4.3", "status": "exceptions" },
22+
{ "rule": "1.4.6", "status": "failed" },
23+
{ "rule": "2.1.1", "status": "passed" },
24+
{ "rule": "2.1.2", "status": "passed" },
25+
{ "rule": "2.1.3", "status": "passed" },
26+
{ "rule": "2.4.7", "status": "passed" },
27+
{ "rule": "2.4.13", "status": "failed" },
28+
{ "rule": "2.5.3", "status": "conditional" },
29+
{ "rule": "2.5.5", "status": "failed" },
30+
{ "rule": "2.5.8", "status": "passed" },
31+
{ "rule": "4.1.2", "status": "conditional" },
32+
{ "rule": "4.1.3", "status": "passed" }
33+
],
34+
"menu": [
35+
{ "rule": "1.4.3", "status": "passed" },
36+
{ "rule": "1.4.6", "status": "passed" },
37+
{ "rule": "1.4.11", "status": "passed" },
38+
{ "rule": "1.4.13", "status": "passed" },
39+
{ "rule": "2.1.1", "status": "passed" },
40+
{ "rule": "2.1.2", "status": "passed" },
41+
{ "rule": "2.4.4", "status": "conditional" },
42+
{ "rule": "2.4.7", "status": "failed" },
43+
{ "rule": "2.4.13", "status": "failed" },
44+
{ "rule": "2.5.5", "status": "failed" },
45+
{ "rule": "2.5.8", "status": "passed" },
1346
{ "rule": "3.2.1", "status": "passed" },
47+
{ "rule": "3.2.4", "status": "conditional" },
48+
{ "rule": "3.2.5", "status": "passed" },
1449
{ "rule": "4.1.2", "status": "passed" }
1550
]
1651
}

aries-site/src/layouts/content/AccessibilitySection.js

+8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/* eslint-disable react/prop-types */
22
import React, { useState, useMemo, useEffect } from 'react';
3+
import { Notification } from 'grommet';
34
import { WCAGRuleDetail, WCAGRuleSummary } from '.';
45
import componentData from '../../data/wcag/components.json';
56

@@ -87,6 +88,13 @@ export const AccessibilitySection = ({ title, version }) => {
8788

8889
return (
8990
<>
91+
<Notification
92+
status="info"
93+
margin={{ bottom: 'medium' }}
94+
width="large"
95+
// eslint-disable-next-line max-len
96+
message="WCAG rules marked as conditional indicate that the implementer must take additional actions to ensure full compliance."
97+
/>
9098
<WCAGRuleSummary statuses={statusData} />
9199
<WCAGRuleDetail version={version || '2.2'} rules={comparisons} />
92100
</>

aries-site/src/layouts/content/WCAGRuleDetail.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ const getStatusIcon = status => {
2424
return <StatusCriticalSmall alt="" color="status-critical" />;
2525
case 'conditional':
2626
return <CircleInformation alt="" />;
27-
case 'passed with exceptions':
27+
case 'exceptions':
2828
return <StatusWarningSmall alt="" color="status-warning" />;
2929
default:
3030
return <StatusGoodSmall alt="" color="status-ok" />;

aries-site/src/layouts/content/WCAGRuleSummary.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const STATUS_MAP = {
1212
label: 'Passed',
1313
icon: <StatusGoodSmall alt="" color="status-ok" />,
1414
},
15-
passedWithExceptions: {
15+
exceptions: {
1616
label: 'Passed with Exceptions',
1717
icon: <StatusWarningSmall alt="" color="status-warning" />,
1818
},
@@ -43,7 +43,7 @@ const calculateAccessibilityTestCounts = statuses =>
4343
},
4444
{
4545
passed: 0,
46-
passedWithExceptions: 0,
46+
exceptions: 0,
4747
failed: 0,
4848
conditional: 0,
4949
},

aries-site/src/pages/components/anchor.mdx

-2
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,6 @@ Used to indicate that an anchor cannot be interacted with.
131131
### A11y guidance
132132
The following guidance should be considered for each instance of the component and is the responsibility of the implementer. WCAG criteria provided directly by the Grommet component are summarized under [WCAG compliance](#wcag-compliance).
133133

134-
**Note**: WCAG rules marked as conditional indicate that the implementer must take additional actions to ensure full compliance.
135-
136134
**Use 'target' and 'rel' props when linking externally:**
137135

138136
If clicking an Anchor leads to an external URL, apply these props to the anchor:

aries-site/src/pages/components/button.mdx

+19-7
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
import { BestPracticeGroup, Example } from '../../layouts';
1+
import {
2+
AccessibilitySection,
3+
BestPracticeGroup,
4+
Example,
5+
} from '../../layouts';
26
import {
37
ButtonBadCancelPreview,
48
ButtonBadGroupPreview,
@@ -137,12 +141,6 @@ For buttons with icons ONLY, it is important that you show the two following ele
137141

138142
2. Inform the user of what will happen when the button is clicked by including `a11yTitle` or `aria-label`.
139143

140-
### Accessibility
141-
142-
If pressing a Button results in a new URL, or the resultant UI makes sense as "a new browser tab," that is a link `<a>`. Everything else is a `<button>`.
143-
144-
The distinction is important to screen reader users to know what's going to happen next. Will I navigate somewhere or will something happen on the page? So it's important to choose the right HTML element for the job.
145-
146144
## Primary buttons
147145

148146
Primary buttons highlight actions on a page delivering the most benefit to users. They are helpful in enabling users’ goals, unlocking new value by enabling a new experience, capability, or creation of something which hadn’t previously existed.
@@ -381,3 +379,17 @@ For button groups on screen widths less than or equal to 576px (Grommet "small")
381379
<ButtonBadGroupPreview />
382380
</Example>
383381
</BestPracticeGroup>
382+
383+
## Accessibility
384+
### A11y guidance
385+
The following guidance should be considered for each instance of the component and is the responsibility of the implementer. WCAG criteria provided directly by the Grommet component are summarized under [WCAG compliance](#wcag-compliance).
386+
387+
If pressing a Button results in a new URL, or the resultant UI makes sense as "a new browser tab," that is a link `<a>`. Everything else is a `<button>`.
388+
389+
The distinction is important to screen reader users to know what's going to happen next. Will I navigate somewhere or will something happen on the page? So it's important to choose the right HTML element for the job.
390+
391+
If using an `<a>` tag, see the [WCAG rules for the Anchor component](/components/anchor#wcag-compliance).
392+
393+
### WCAG compliance
394+
395+
<AccessibilitySection title="button" />

aries-site/src/pages/components/menu.mdx

+10-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Box } from 'grommet';
2-
import { BestPracticeGroup, Example } from '../../layouts';
2+
import { AccessibilitySection, BestPracticeGroup, Example } from '../../layouts';
33
import {
44
MenuExample,
55
MenuBatchActionsExample,
@@ -41,12 +41,6 @@ To create a predictable experience for users, the following are guidelines for u
4141

4242
**Avoid creating cascading menus.** Menus with multiple layers creates a confusing experience for the user because relevant actions may become nested and difficult to find. Refining menu items to necessary actions creates a more manageable user experience.
4343

44-
### Accessibility
45-
46-
Accessibility features such as screen reader messages are automatically built into Menu. By default, these messages are "Open Menu" and "Close Menu". However, if a more specific message is necessary, a custom [a11yTitle](https://v2.grommet.io/menu?theme=hpe#a11yTitle) or [messages](https://v2.grommet.io/menu?theme=hpe#messages) may be applied.
47-
48-
An icon can be used on a menu item to provide additional context about the action. It is recommended that an icon is used in conjunction with text to ensure the context of the menu item is clear. However, there may be cases where an icon alone is sufficient. For example, highly familiar action indicators, such as this example of [Menu with custom icon](#with-custom-icon) demonstrate when an icon only may be sufficient.
49-
5044
## Organizing menu items
5145

5246
Allow a user to quickly locate the menu item they desire by organizing menu items
@@ -283,3 +277,12 @@ Used to indicate that a Menu cannot be interacted with.
283277
>
284278
<MenuDisabledExample />
285279
</Example>
280+
281+
### Accessibility
282+
283+
Accessibility features such as screen reader messages are automatically built into Menu. By default, these messages are "Open Menu" and "Close Menu". However, if a more specific message is necessary, a custom [a11yTitle](https://v2.grommet.io/menu?theme=hpe#a11yTitle) or [messages](https://v2.grommet.io/menu?theme=hpe#messages) may be applied.
284+
285+
An icon may be used on a menu item to provide additional context about the action. It is recommended that an icon is used in conjunction with text to ensure the context of the menu item is clear. However, there may be cases where an icon alone is sufficient. For example, highly familiar action indicators, such as this example of [Menu with custom icon](#with-custom-icon) demonstrate when an icon only may be sufficient.
286+
287+
### WCAG compliance
288+
<AccessibilitySection title='menu' />

sandbox/grommet-app/src/pages/sticker-sheet/index.jsx

-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ const textSizes = [
6565
'3xl',
6666
'4xl',
6767
'5xl',
68-
'6xl',
6968
];
7069

7170
const StickerSheet = () => {

sandbox/grommet-app/src/themes/theme.jsx

+45-17
Original file line numberDiff line numberDiff line change
@@ -541,18 +541,46 @@ const buildTheme = tokens => {
541541

542542
const paragraphTheme = {};
543543
const textTheme = {};
544+
const fontWeights = {};
545+
// Keep track of the largest text size to use as a fallback
546+
// because grommet theme has a max size of 6xl, but design tokens
547+
// only supports up to 5xl.
548+
const fallback = {
549+
size: '0rem',
550+
height: '0rem',
551+
maxWidth: '0rem',
552+
weight: 0,
553+
};
544554
textSizes.forEach(size => {
555+
if (
556+
parseInt(large.hpe.text?.[size]?.fontSize.replace('rem', ''), 10) >
557+
parseInt(fallback.size.replace('rem', ''), 10)
558+
) {
559+
fallback.size = large.hpe.text?.[size]?.fontSize;
560+
fallback.height = large.hpe.text?.[size]?.lineHeight;
561+
fallback.maxWidth = large.hpe.text?.[size]?.maxWidth;
562+
fallback.weight = large.hpe.text?.[size]?.fontWeight;
563+
}
545564
paragraphTheme[size] = {
546-
size: large.hpe.text?.[size]?.fontSize,
547-
height: large.hpe.text?.[size]?.lineHeight,
548-
maxWidth: large.hpe.text?.[size]?.maxWidth,
565+
size: large.hpe.text?.[size]?.fontSize || fallback.size,
566+
height: large.hpe.text?.[size]?.lineHeight || fallback.height,
567+
maxWidth: large.hpe.text?.[size]?.maxWidth || fallback.maxWidth,
549568
};
550569
textTheme[size] = {
551-
size: large.hpe.text?.[size].fontSize,
552-
height: large.hpe.text?.[size].lineHeight,
570+
size: large.hpe.text?.[size]?.fontSize || fallback.size,
571+
height: large.hpe.text?.[size]?.lineHeight || fallback.height,
553572
};
573+
fontWeights[size] = large.hpe.text?.[size]?.fontWeight || fallback.weight;
554574
});
555575

576+
textTheme.extend = ({ size }) => {
577+
return `font-weight: ${fontWeights[size]};`;
578+
};
579+
580+
paragraphTheme.extend = ({ size }) => {
581+
return `font-weight: ${fontWeights[size]};`;
582+
};
583+
556584
const buttonKindTheme = {};
557585
buttonKinds.forEach(kind => {
558586
const borderWidth = oldTheme
@@ -756,37 +784,37 @@ const buildTheme = tokens => {
756784
face: `
757785
@font-face {
758786
font-family: "Metric";
759-
src: url("https://www.hpe.com/h41225/hfws-static/fonts/metric-hpe-web/MetricHPE-Web-Regular.woff2") format('woff2'),
760-
url("https://www.hpe.com/h41225/hfws-static/fonts/metric-hpe-web/MetricHPE-Web-Regular.woff") format('woff');
787+
src: url("https://www.hpe.com/content/dam/hpe/fonts/metric-hpe-web/MetricHPE-Web-Regular.woff2") format('woff2'),
788+
url("https://www.hpe.com/content/dam/hpe/fonts/metric-hpe-web/MetricHPE-Web-Regular.woff") format('woff');
761789
}
762790
@font-face {
763791
font-family: "Metric";
764-
src: url("https://www.hpe.com/h41225/hfws-static/fonts/metric-hpe-web/MetricHPE-Web-Regular.woff2") format('woff2'),
765-
url("https://www.hpe.com/h41225/hfws-static/fonts/metric-hpe-web/MetricHPE-Web-Regular.woff") format('woff');
792+
src: url("https://www.hpe.com/content/dam/hpe/fonts/metric-hpe-web/MetricHPE-Web-Regular.woff2") format('woff2'),
793+
url("https://www.hpe.com/content/dam/hpe/fonts/metric-hpe-web/MetricHPE-Web-Regular.woff") format('woff');
766794
font-weight: 400;
767795
}
768796
@font-face {
769797
font-family: "Metric";
770-
src: url("https://www.hpe.com/h41225/hfws-static/fonts/metric-hpe-web/MetricHPE-Web-Bold.woff2") format('woff2'),
771-
url("https://www.hpe.com/h41225/hfws-static/fonts/metric-hpe-web/MetricHPE-Web-Bold.woff") format('woff');
798+
src: url("https://www.hpe.com/content/dam/hpe/fonts/metric-hpe-web/MetricHPE-Web-Bold.woff2") format('woff2'),
799+
url("https://www.hpe.com/content/dam/hpe/fonts/metric-hpe-web/MetricHPE-Web-Bold.woff") format('woff');
772800
font-weight: 700;
773801
}
774802
@font-face {
775803
font-family: "Metric";
776-
src: url("https://www.hpe.com/h41225/hfws-static/fonts/metric-hpe-web/MetricHPE-Web-Semibold.woff2") format('woff2'),
777-
url("https://www.hpe.com/h41225/hfws-static/fonts/metric-hpe-web/MetricHPE-Web-Semibold.woff") format('woff');
804+
src: url("https://www.hpe.com/content/dam/hpe/fonts/metric-hpe-web/MetricHPE-Web-Semibold.woff2") format('woff2'),
805+
url("https://www.hpe.com/content/dam/hpe/fonts/metric-hpe-web/MetricHPE-Web-Semibold.woff") format('woff');
778806
font-weight: 600;
779807
}
780808
@font-face {
781809
font-family: "Metric";
782-
src: url("https://www.hpe.com/h41225/hfws-static/fonts/metric-hpe-web/MetricHPE-Web-Medium.woff2") format('woff2'),
783-
url("https://www.hpe.com/h41225/hfws-static/fonts/metric-hpe-web/MetricHPE-Web-Medium.woff") format('woff');
810+
src: url("https://www.hpe.com/content/dam/hpe/fonts/metric-hpe-web/MetricHPE-Web-Medium.woff2") format('woff2'),
811+
url("https://www.hpe.com/content/dam/hpe/fonts/metric-hpe-web/MetricHPE-Web-Medium.woff") format('woff');
784812
font-weight: 500;
785813
}
786814
@font-face {
787815
font-family: "Metric";
788-
src: url("https://www.hpe.com/h41225/hfws-static/fonts/metric-hpe-web/MetricHPE-Web-Light.woff2") format('woff2'),
789-
url("https://www.hpe.com/h41225/hfws-static/fonts/metric-hpe-web/MetricHPE-Web-Light.woff") format('woff');
816+
src: url("https://www.hpe.com/content/dam/hpe/fonts/metric-hpe-web/MetricHPE-Web-Light.woff2") format('woff2'),
817+
url("https://www.hpe.com/content/dam/hpe/fonts/metric-hpe-web/MetricHPE-Web-Light.woff") format('woff');
790818
font-weight: 100;
791819
}`,
792820
size: large.hpe.text.medium.fontSize,

0 commit comments

Comments
 (0)