Skip to content

Commit 5c57bef

Browse files
authoredOct 8, 2024··
docs(charts): outline a11y limitations (#6457)
This PR also adds a `tsconfig.json` to the `.storybook` folder and fixes a misconfiguration in the root tsconfig.
1 parent 6de7aa7 commit 5c57bef

File tree

15 files changed

+50
-18
lines changed

15 files changed

+50
-18
lines changed
 

‎.storybook/components/DocsHeader.tsx

+26-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,17 @@
11
import { Description, DocsContext, Subtitle, Title } from '@storybook/addon-docs';
2-
import copyIcon from '@ui5/webcomponents-icons/dist/copy';
32
import ButtonDesign from '@ui5/webcomponents/dist/types/ButtonDesign.js';
4-
import { Button, FlexBox, FlexBoxAlignItems, Label, Link, Text, ThemeProvider } from '@ui5/webcomponents-react';
3+
import MessageStripDesign from '@ui5/webcomponents/dist/types/MessageStripDesign.js';
4+
import copyIcon from '@ui5/webcomponents-icons/dist/copy.js';
5+
import {
6+
Button,
7+
FlexBox,
8+
FlexBoxAlignItems,
9+
Label,
10+
Link,
11+
MessageStrip,
12+
Text,
13+
ThemeProvider
14+
} from '@ui5/webcomponents-react';
515
import { clsx } from 'clsx';
616
import { useContext } from 'react';
717
import { useGetSubComponentsOfModule } from '../utils';
@@ -38,6 +48,7 @@ interface InfoTableProps {
3848
since?: string;
3949
subComponents?: string[];
4050
mergeSubComponents?: boolean;
51+
isChart?: boolean;
4152
}
4253

4354
export const InfoTable = ({ since, subComponents, mergeSubComponents }: InfoTableProps) => {
@@ -74,7 +85,7 @@ export const InfoTable = ({ since, subComponents, mergeSubComponents }: InfoTabl
7485
<Button
7586
design={ButtonDesign.Transparent}
7687
className={clsx('ui5-content-density-compact', classes.copyBtn)}
77-
onClick={handleCopy}
88+
onClick={void handleCopy}
7889
icon={copyIcon}
7990
tooltip="copy"
8091
/>
@@ -102,7 +113,7 @@ export const InfoTable = ({ since, subComponents, mergeSubComponents }: InfoTabl
102113
<Button
103114
design={ButtonDesign.Transparent}
104115
className={clsx('ui5-content-density-compact', classes.copyBtn)}
105-
onClick={handleCopy}
116+
onClick={void handleCopy}
106117
icon={copyIcon}
107118
tooltip="copy"
108119
/>
@@ -115,7 +126,7 @@ export const InfoTable = ({ since, subComponents, mergeSubComponents }: InfoTabl
115126
);
116127
};
117128

118-
export const DocsHeader = ({ since, subComponents, mergeSubComponents }: InfoTableProps) => {
129+
export const DocsHeader = ({ since, subComponents, mergeSubComponents, isChart }: InfoTableProps) => {
119130
return (
120131
<ThemeProvider>
121132
<FlexBox alignItems={FlexBoxAlignItems.Center}>
@@ -127,6 +138,16 @@ export const DocsHeader = ({ since, subComponents, mergeSubComponents }: InfoTab
127138
<InfoTable since={since} subComponents={subComponents} mergeSubComponents={mergeSubComponents} />
128139
<TableOfContent />
129140
<Description />
141+
{isChart && (
142+
<>
143+
<MessageStrip hideCloseButton design={MessageStripDesign.Critical}>
144+
Charts only offer limited accessibility support with only basic built-in features, so it’s essential to
145+
ensure your implementation meets the accessibility standards of your application.
146+
</MessageStrip>
147+
<br />
148+
<br />
149+
</>
150+
)}
130151
</ThemeProvider>
131152
);
132153
};

‎.storybook/tsconfig.json

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"extends": "./../tsconfig.base.json",
3+
"compilerOptions": {
4+
"allowJs": true
5+
},
6+
"include": ["./**/*.js", "./**/*.tsx"]
7+
}

‎packages/charts/src/components/BarChart/BarChart.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import * as ComponentStories from './BarChart.stories';
55

66
<Meta of={ComponentStories} />
77

8-
<DocsHeader />
8+
<DocsHeader isChart />
99

1010
## Example
1111

‎packages/charts/src/components/BulletChart/BulletChart.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import * as ComponentStories from './BulletChart.stories';
55

66
<Meta of={ComponentStories} />
77

8-
<DocsHeader />
8+
<DocsHeader isChart />
99

1010
## Example
1111

‎packages/charts/src/components/ColumnChart/ColumnChart.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import * as ComponentStories from './ColumnChart.stories';
55

66
<Meta of={ComponentStories} />
77

8-
<DocsHeader />
8+
<DocsHeader isChart />
99

1010
## Example
1111

‎packages/charts/src/components/ColumnChartWithTrend/ColumnChartWithTrend.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import * as ComponentStories from './ColumnChartWithTrend.stories';
44

55
<Meta of={ComponentStories} />
66

7-
<DocsHeader />
7+
<DocsHeader isChart />
88

99
## Example
1010

‎packages/charts/src/components/ComposedChart/ComposedChart.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import * as ComponentStories from './ComposedChart.stories';
55

66
<Meta of={ComponentStories} />
77

8-
<DocsHeader />
8+
<DocsHeader isChart />
99

1010
## Example
1111

‎packages/charts/src/components/DonutChart/DonutChart.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import * as ComponentStories from './DonutChart.stories';
55

66
<Meta of={ComponentStories} />
77

8-
<DocsHeader />
8+
<DocsHeader isChart />
99

1010
## Example
1111

‎packages/charts/src/components/LineChart/LineChart.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import * as ComponentStories from './LineChart.stories';
55

66
<Meta of={ComponentStories} />
77

8-
<DocsHeader />
8+
<DocsHeader isChart />
99

1010
## Example
1111

‎packages/charts/src/components/PieChart/PieChart.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import * as ComponentStories from './PieChart.stories';
55

66
<Meta of={ComponentStories} />
77

8-
<DocsHeader />
8+
<DocsHeader isChart />
99

1010
## Example
1111

‎packages/charts/src/components/RadarChart/RadarChart.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import * as ComponentStories from './RadarChart.stories';
55

66
<Meta of={ComponentStories} />
77

8-
<DocsHeader />
8+
<DocsHeader isChart />
99

1010
## Example
1111

‎packages/charts/src/components/RadialChart/RadialChart.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import * as ComponentStories from './RadialChart.stories';
44

55
<Meta of={ComponentStories} />
66

7-
<DocsHeader />
7+
<DocsHeader isChart />
88

99
## Example
1010

‎packages/charts/src/components/ScatterChart/ScatterChart.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import * as ComponentStories from './ScatterChart.stories';
55

66
<Meta of={ComponentStories} />
77

8-
<DocsHeader />
8+
<DocsHeader isChart />
99

1010
## Example
1111

‎packages/charts/src/components/TimelineChart/TimeLineChart.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { TimelineChartAnnotation } from './TimelineChartAnnotation';
66

77
<Meta of={ComponentStories} />
88

9-
<DocsHeader since="1.10.0" />
9+
<DocsHeader isChart since="1.10.0" />
1010

1111
<Canvas of={ComponentStories.Default} />
1212

‎tsconfig.json

+5-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,11 @@
2121
},
2222
{
2323
"path": "./tsconfig.spec.json"
24+
},
25+
{
26+
"path": "./.storybook/tsconfig.json"
2427
}
2528
],
26-
"files": ["vite.config.ts", ".storybook", "docs", "types.d.ts"]
29+
"files": ["vite.config.ts", "types.d.ts"],
30+
"include": [".storybook", "docs"]
2731
}

0 commit comments

Comments
 (0)
Please sign in to comment.