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

feat(avt): a11y status page and a11y status table component #3866

Merged
merged 64 commits into from
Feb 2, 2024
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
eee4393
chore: wip
alisonjoseph Jan 2, 2024
64492bb
feat: add missing components to overview page
alisonjoseph Jan 2, 2024
2c141ed
chore: conflict
alisonjoseph Jan 3, 2024
8e0d205
chore: merge
alisonjoseph Jan 3, 2024
ff975a0
chore: component list updates
alisonjoseph Jan 3, 2024
53b85bd
chore: yarn
alisonjoseph Jan 3, 2024
4e23037
chore: wip
alisonjoseph Jan 3, 2024
11ce0bf
feat: a11y status page content
alisonjoseph Jan 3, 2024
b2a40a1
feat: add screenreader data and tag style fixes
alisonjoseph Jan 4, 2024
5a0fb3b
chore: cleanup
alisonjoseph Jan 4, 2024
f881e4f
feat: add partially tested
alisonjoseph Jan 4, 2024
ed4521b
feat: add all components from testing data
alisonjoseph Jan 5, 2024
04f6a0e
chore: merge
alisonjoseph Jan 5, 2024
8ca35f4
chore: yarn install state
alisonjoseph Jan 5, 2024
0c98ffa
chore: cleanup code
alisonjoseph Jan 5, 2024
a2e0eff
feat: add launch icon
alisonjoseph Jan 5, 2024
633dc8e
chore: merge conflict
alisonjoseph Jan 5, 2024
fb17bc4
Merge branch 'main' into a11y-status
alisonjoseph Jan 5, 2024
dcff6c3
feat: add redirect
alisonjoseph Jan 5, 2024
c5fef04
chore: merge
alisonjoseph Jan 5, 2024
f9c3eaf
chore: fix install state
alisonjoseph Jan 5, 2024
0f20647
fix: update ui shell link
alisonjoseph Jan 5, 2024
580290a
fix: link to use carbon link component
alisonjoseph Jan 5, 2024
83135ae
fix: add Equal Access Checker link
alisonjoseph Jan 5, 2024
b637747
fix: add missing links to content
alisonjoseph Jan 5, 2024
3dd45d1
fix: add Taylor copy updates
alisonjoseph Jan 5, 2024
648628d
fix: more copy updates
alisonjoseph Jan 5, 2024
25432d7
fix: copy updates
alisonjoseph Jan 5, 2024
478bdb5
fix: copy updates
alisonjoseph Jan 5, 2024
0095ce3
Update src/pages/components/overview/accessibility-status.mdx
alisonjoseph Jan 5, 2024
5e43669
Update src/pages/components/overview/accessibility-status.mdx
alisonjoseph Jan 5, 2024
8895fd9
Update src/pages/components/overview/accessibility-status.mdx
alisonjoseph Jan 5, 2024
1079a24
Update src/pages/components/overview/accessibility-status.mdx
alisonjoseph Jan 5, 2024
13c8700
Update src/pages/components/overview/accessibility-status.mdx
alisonjoseph Jan 5, 2024
5ff24ac
Update src/pages/components/overview/accessibility-status.mdx
alisonjoseph Jan 5, 2024
a871297
Update src/pages/components/overview/accessibility-status.mdx
alisonjoseph Jan 5, 2024
7d0133c
Update src/pages/components/overview/accessibility-status.mdx
alisonjoseph Jan 5, 2024
74e8886
chore: format
alisonjoseph Jan 5, 2024
f49baa6
fix: component data
alisonjoseph Jan 5, 2024
bd0b641
fix: data
alisonjoseph Jan 5, 2024
54f0ef2
fix: update screenreader status for experimental components
alisonjoseph Jan 8, 2024
872d8ce
fix: tag for experimental components
alisonjoseph Jan 8, 2024
2d5f5f2
chore: remove style override for tag font
alisonjoseph Jan 8, 2024
c5431eb
fix: update data
alisonjoseph Jan 9, 2024
613fd2f
feat: add tooltips
alisonjoseph Jan 9, 2024
25b203e
fix: style specificity
alisonjoseph Jan 9, 2024
27bae62
chore: cleanup
alisonjoseph Jan 9, 2024
ff138bc
feat: add filter for specific components
alisonjoseph Jan 9, 2024
9842fe7
feat: add tooltips
alisonjoseph Jan 9, 2024
f2d091a
chore: add missing title
alisonjoseph Jan 9, 2024
9a37c92
chore: add code comments
alisonjoseph Jan 9, 2024
25c076f
chore: oops
alisonjoseph Jan 9, 2024
a985b61
feat: update descriptions, add tooltip, fix wrapping
alisonjoseph Jan 16, 2024
90a7b74
feat: add to all a11y component pages
alisonjoseph Jan 17, 2024
8dbef67
fix: update github url to handle names with multiple spaces
alisonjoseph Jan 17, 2024
ba261c0
chore: remove console log
alisonjoseph Jan 17, 2024
60160ac
fix: paragraph spacings
alisonjoseph Jan 17, 2024
c10db08
chore: rename component and update theme
alisonjoseph Jan 23, 2024
474ded5
fix: add link component
alisonjoseph Jan 23, 2024
8888263
chore: merge conflicts
alisonjoseph Jan 24, 2024
be127ca
fix: anchor links
alisonjoseph Jan 25, 2024
f54a6fc
fix: url for aspect ratio
alisonjoseph Jan 30, 2024
f349f0e
fix: mobile paragraph spacing
alisonjoseph Feb 1, 2024
d5faf08
Merge branch 'main' into a11y-status
andreancardona Feb 2, 2024
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
Binary file modified .yarn/install-state.gz
Binary file not shown.
228 changes: 228 additions & 0 deletions src/components/A11yStatus/A11yStatus.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,228 @@
/* eslint-disable global-require */
import React from 'react';
import { Tag } from '@carbon/react';
import componentList from '../../data/components.json';
import * as avtTestData from '@carbon/react/.playwright/INTERNAL_AVT_REPORT_DO_NOT_USE.json';
import packageJson from '../../../package.json';

import { table } from './a11y-status.module.scss';

const filteredComponentList = componentList.components.filter(
(item) => item.a11ystatus !== false
);

class A11yStatus extends React.Component {
render() {
const reactVersion = packageJson.dependencies['@carbon/react'];
const TestedTag = <Tag type="green">Tested</Tag>;
const NotTestedTag = <Tag type="purple">Not yet tested</Tag>;
const PartiallyTestedTag = <Tag type="blue">Partially tested</Tag>;
const ManuallyTestedTag = <Tag type="teal">Manually tested</Tag>;
const NotAvailableTag = <Tag>Not available</Tag>;

return (
<div className="cds--row">
<div className="cds--col-lg-12">
<p>
<strong>Latest version:</strong> {reactVersion} |{' '}
<strong>Framework</strong> React (@carbon/react)
</p>
</div>
<div
className={`${table} cds--col-lg-12 cds--col-no-gutter page-table__container`}>
<table className="page-table">
<thead>
<tr>
<th>Component</th>
<th>Accessibility test</th>
<th>Status</th>
<th>Link to source code</th>
</tr>
</thead>
<tbody>
{Object.keys(filteredComponentList).map((component) => {
const componentName =
filteredComponentList[component].component;
const componentTestData = avtTestData.default.suites.find(
(suite) => {
return suite.title
.toLowerCase()
.includes(componentName.toLowerCase().replace(' ', ''));
}
);

const githubUrl = `https://github.com/carbon-design-system/carbon/tree/main/packages/react/src/components/${componentName
.replace(/\b\w/g, (char) => char.toUpperCase())
.replace(' ', '')}`;

// Function to check if the spec has a specific tag and
// if the status is skipped
function checkAVTStatus(componentTestData, tag) {
let hasAVT = false;
let hasSkippedAVT = false;

if (componentTestData) {
hasAVT = componentTestData.suites.some((suite) => {
const searchSuites = suite.suites || [suite];
return searchSuites.some((innerSuite) =>
innerSuite.specs.some((spec) =>
spec.tags.some((specTag) => specTag.includes(tag))
)
);
});

hasSkippedAVT = componentTestData.suites.some((suite) =>
(suite.suites || [suite]).some((innerSuite) =>
innerSuite.specs.some(
(spec) =>
spec.tags?.includes(tag) &&
spec.tests.some((test) => test.status === 'skipped')
)
)
);
}

return { hasAVT, hasSkippedAVT };
}

const {
hasAVT: hasDefaultAVT,
hasSkippedAVT: hasSkippedDefaultAVT,
} = checkAVTStatus(componentTestData, 'avt-default-state');
const {
hasAVT: hasAdvancedAVT,
hasSkippedAVT: hasSkippedAdvancedAVT,
} = checkAVTStatus(componentTestData, 'avt-advanced-states');
const {
hasAVT: hasKeyboardNavAVT,
hasSkippedAVT: hasSkippedKeyboardNavAVT,
} = checkAVTStatus(componentTestData, 'avt-keyboard-nav');

// tag for default AVT
let defaultAVTTag;
if (hasSkippedDefaultAVT == true) {
defaultAVTTag = PartiallyTestedTag;
} else if (hasDefaultAVT == true) {
defaultAVTTag = TestedTag;
} else {
defaultAVTTag = NotTestedTag;
}

// tag for advanced AVT
let advancedAVTTag;
if (hasSkippedAdvancedAVT == true) {
advancedAVTTag = PartiallyTestedTag;
} else if (hasAdvancedAVT == true) {
advancedAVTTag = TestedTag;
} else {
advancedAVTTag = NotTestedTag;
}

// tag for keyboard AVT
let keyboardNavAVTTag;
if (hasSkippedKeyboardNavAVT == true) {
keyboardNavAVTTag = PartiallyTestedTag;
} else if (hasKeyboardNavAVT == true) {
keyboardNavAVTTag = TestedTag;
} else {
keyboardNavAVTTag = NotAvailableTag;
}

// tag for screen reader AVT
const screenReaderAVT =
filteredComponentList[component].testing.screenreader;
let screenReaderAVTTag;
switch (screenReaderAVT) {
case 'manual':
screenReaderAVTTag = ManuallyTestedTag;
break;
case 'partial':
screenReaderAVTTag = PartiallyTestedTag;
break;
case 'notavailable':
screenReaderAVTTag = NotAvailableTag;
break;
default:
screenReaderAVTTag = NotTestedTag;
}

// link for component name in table
let componentUrl;
if (componentName === 'Aspect ratio') {
componentUrl = '/2x-grid/overview/#aspect-ratio';
} else if (
componentName === 'Grid' ||
componentName === 'FlexGrid'
) {
componentUrl = '/2x-grid/overview';
} else if (componentName === 'Theme') {
componentUrl = '/guidelines/themes/overview/';
}
// if a parent component is set link to the parent component
else if (filteredComponentList[component].parentComponent) {
componentUrl = `/components/${filteredComponentList[
component
].parentComponent
.toLowerCase()
.replace(' ', '-')}/usage`;
}
// if component isn't linked on overview page and no parent
// component set then there is no where to link to so set
// to null
else if (
filteredComponentList[component].overview === false &&
filteredComponentList[component].parentComponent === undefined
) {
componentUrl = null;
} else {
componentUrl = `/components/${componentName
.toLowerCase()
.replace(' ', '-')}/usage`;
}

return (
<React.Fragment key={`avt-tests-${componentName}`}>
<tr>
<td>
{componentUrl === null ? (
componentName
) : (
<a href={componentUrl}>{componentName}</a>
)}
</td>
<td>Default state</td>
<td>{defaultAVTTag}</td>
<td>
<a href={githubUrl}>Github link</a>
</td>
</tr>
<tr>
<td></td>
<td>Advanced states</td>
<td>{advancedAVTTag}</td>
<td></td>
</tr>
<tr>
<td></td>
<td>Keyboard states</td>
<td>{keyboardNavAVTTag}</td>
<td></td>
</tr>
<tr>
<td></td>
<td>Screen reader</td>
<td>{screenReaderAVTTag}</td>
<td></td>
</tr>
</React.Fragment>
);
})}
</tbody>
</table>
</div>
</div>
);
}
}

export default A11yStatus;
13 changes: 13 additions & 0 deletions src/components/A11yStatus/a11y-status.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.table {
margin-top: $spacing-06;
}

:global(.page-table .cds--tag) {
margin-left: 0;
white-space: nowrap;

span {
//override to fix alignment issue with variable font
Copy link
Member Author

@alisonjoseph alisonjoseph Jan 5, 2024

Choose a reason for hiding this comment

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

TODO: check if we have latest version of Plex VF. alignment issues should have been fixed IBM/plex#377

Copy link
Member

Choose a reason for hiding this comment

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

I can't remember how we're bringing in Plex, but the latest version binary is too large to update. We might need to pull it in via Akamai instead for the time being.

Copy link
Member Author

Choose a reason for hiding this comment

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

Looks like they are being pulled directly from the theme.
https://github.com/carbon-design-system/gatsby-theme-carbon/tree/main/fonts
https://github.com/carbon-design-system/gatsby-theme-carbon/blob/main/packages/gatsby-theme-carbon/src/styles/internal/_plex.scss

We could probably update that to pull from Akamai instead? I'll take a look next week.

padding-top: 2px;
}
}
3 changes: 3 additions & 0 deletions src/components/A11yStatus/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import A11yStatus from './A11yStatus';

export default A11yStatus;
8 changes: 6 additions & 2 deletions src/components/ComponentOverview/ComponentOverview.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ import React from 'react';
import { Link } from 'gatsby';
import componentList from '../../data/components.json';

// only display components where overview is true in the data
const filteredComponentList = componentList.components.filter(
(item) => item.overview !== false
);
class ComponentOverview extends React.Component {
renderItems = (currentItem) => {
const { component } = currentItem;
Expand Down Expand Up @@ -48,8 +52,8 @@ class ComponentOverview extends React.Component {
<div className="cds--row">
<div className="cds--col-lg-12 cds--no-gutter">
<ul className="component-overview">
{Object.keys(componentList.components).map((component) =>
this.renderItems(componentList.components[component])
{Object.keys(filteredComponentList).map((component) =>
this.renderItems(filteredComponentList[component])
)}
</ul>
</div>
Expand Down
Loading
Loading