-
Notifications
You must be signed in to change notification settings - Fork 793
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
Changes from 15 commits
Commits
Show all changes
64 commits
Select commit
Hold shift + click to select a range
eee4393
chore: wip
alisonjoseph 64492bb
feat: add missing components to overview page
alisonjoseph 2c141ed
chore: conflict
alisonjoseph 8e0d205
chore: merge
alisonjoseph ff975a0
chore: component list updates
alisonjoseph 53b85bd
chore: yarn
alisonjoseph 4e23037
chore: wip
alisonjoseph 11ce0bf
feat: a11y status page content
alisonjoseph b2a40a1
feat: add screenreader data and tag style fixes
alisonjoseph 5a0fb3b
chore: cleanup
alisonjoseph f881e4f
feat: add partially tested
alisonjoseph ed4521b
feat: add all components from testing data
alisonjoseph 04f6a0e
chore: merge
alisonjoseph 8ca35f4
chore: yarn install state
alisonjoseph 0c98ffa
chore: cleanup code
alisonjoseph a2e0eff
feat: add launch icon
alisonjoseph 633dc8e
chore: merge conflict
alisonjoseph fb17bc4
Merge branch 'main' into a11y-status
alisonjoseph dcff6c3
feat: add redirect
alisonjoseph c5fef04
chore: merge
alisonjoseph f9c3eaf
chore: fix install state
alisonjoseph 0f20647
fix: update ui shell link
alisonjoseph 580290a
fix: link to use carbon link component
alisonjoseph 83135ae
fix: add Equal Access Checker link
alisonjoseph b637747
fix: add missing links to content
alisonjoseph 3dd45d1
fix: add Taylor copy updates
alisonjoseph 648628d
fix: more copy updates
alisonjoseph 25432d7
fix: copy updates
alisonjoseph 478bdb5
fix: copy updates
alisonjoseph 0095ce3
Update src/pages/components/overview/accessibility-status.mdx
alisonjoseph 5e43669
Update src/pages/components/overview/accessibility-status.mdx
alisonjoseph 8895fd9
Update src/pages/components/overview/accessibility-status.mdx
alisonjoseph 1079a24
Update src/pages/components/overview/accessibility-status.mdx
alisonjoseph 13c8700
Update src/pages/components/overview/accessibility-status.mdx
alisonjoseph 5ff24ac
Update src/pages/components/overview/accessibility-status.mdx
alisonjoseph a871297
Update src/pages/components/overview/accessibility-status.mdx
alisonjoseph 7d0133c
Update src/pages/components/overview/accessibility-status.mdx
alisonjoseph 74e8886
chore: format
alisonjoseph f49baa6
fix: component data
alisonjoseph bd0b641
fix: data
alisonjoseph 54f0ef2
fix: update screenreader status for experimental components
alisonjoseph 872d8ce
fix: tag for experimental components
alisonjoseph 2d5f5f2
chore: remove style override for tag font
alisonjoseph c5431eb
fix: update data
alisonjoseph 613fd2f
feat: add tooltips
alisonjoseph 25b203e
fix: style specificity
alisonjoseph 27bae62
chore: cleanup
alisonjoseph ff138bc
feat: add filter for specific components
alisonjoseph 9842fe7
feat: add tooltips
alisonjoseph f2d091a
chore: add missing title
alisonjoseph 9a37c92
chore: add code comments
alisonjoseph 25c076f
chore: oops
alisonjoseph a985b61
feat: update descriptions, add tooltip, fix wrapping
alisonjoseph 90a7b74
feat: add to all a11y component pages
alisonjoseph 8dbef67
fix: update github url to handle names with multiple spaces
alisonjoseph ba261c0
chore: remove console log
alisonjoseph 60160ac
fix: paragraph spacings
alisonjoseph c10db08
chore: rename component and update theme
alisonjoseph 474ded5
fix: add link component
alisonjoseph 8888263
chore: merge conflicts
alisonjoseph be127ca
fix: anchor links
alisonjoseph f54a6fc
fix: url for aspect ratio
alisonjoseph f349f0e
fix: mobile paragraph spacing
alisonjoseph d5faf08
Merge branch 'main' into a11y-status
andreancardona File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
padding-top: 2px; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import A11yStatus from './A11yStatus'; | ||
|
||
export default A11yStatus; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.