@workday/canvas-kit-docs 12.0.0-alpha.905-next.0 → 12.0.0-alpha.907-next.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/es6/lib/docs.js
CHANGED
|
@@ -121486,7 +121486,7 @@ export const docs = (typeof window !== 'undefined' && window.__docs) ||
|
|
|
121486
121486
|
"type": {
|
|
121487
121487
|
"kind": "symbol",
|
|
121488
121488
|
"name": "useResizeObserverOriginal",
|
|
121489
|
-
"value": "<T extends
|
|
121489
|
+
"value": "<T extends HTMLElement>(opts?: { ref?: T | RefObject<T> | null | undefined; onResize?: ResizeHandler | undefined; } | undefined) => HookResponse<T>"
|
|
121490
121490
|
}
|
|
121491
121491
|
},
|
|
121492
121492
|
{
|
|
@@ -127583,7 +127583,6 @@ export const docs = (typeof window !== 'undefined' && window.__docs) ||
|
|
|
127583
127583
|
"type": {
|
|
127584
127584
|
"kind": "enhancedComponent",
|
|
127585
127585
|
"componentType": "subcomponent",
|
|
127586
|
-
"elemPropsHook": "useFormFieldLabel",
|
|
127587
127586
|
"displayName": "FormFieldGroup.Label",
|
|
127588
127587
|
"props": [
|
|
127589
127588
|
{
|
|
@@ -130558,6 +130557,27 @@ export const docs = (typeof window !== 'undefined' && window.__docs) ||
|
|
|
130558
130557
|
"tags": {},
|
|
130559
130558
|
"declarations": []
|
|
130560
130559
|
},
|
|
130560
|
+
{
|
|
130561
|
+
"kind": "property",
|
|
130562
|
+
"name": "aria-labelledby",
|
|
130563
|
+
"required": true,
|
|
130564
|
+
"type": {
|
|
130565
|
+
"kind": "union",
|
|
130566
|
+
"value": [
|
|
130567
|
+
{
|
|
130568
|
+
"kind": "primitive",
|
|
130569
|
+
"value": "string"
|
|
130570
|
+
},
|
|
130571
|
+
{
|
|
130572
|
+
"kind": "primitive",
|
|
130573
|
+
"value": "undefined"
|
|
130574
|
+
}
|
|
130575
|
+
]
|
|
130576
|
+
},
|
|
130577
|
+
"description": "",
|
|
130578
|
+
"tags": {},
|
|
130579
|
+
"declarations": []
|
|
130580
|
+
},
|
|
130561
130581
|
{
|
|
130562
130582
|
"kind": "property",
|
|
130563
130583
|
"name": "id",
|
|
@@ -130678,6 +130698,18 @@ export const docs = (typeof window !== 'undefined' && window.__docs) ||
|
|
|
130678
130698
|
"description": "",
|
|
130679
130699
|
"tags": {},
|
|
130680
130700
|
"declarations": []
|
|
130701
|
+
},
|
|
130702
|
+
{
|
|
130703
|
+
"kind": "property",
|
|
130704
|
+
"name": "id",
|
|
130705
|
+
"required": true,
|
|
130706
|
+
"type": {
|
|
130707
|
+
"kind": "primitive",
|
|
130708
|
+
"value": "string"
|
|
130709
|
+
},
|
|
130710
|
+
"description": "",
|
|
130711
|
+
"tags": {},
|
|
130712
|
+
"declarations": []
|
|
130681
130713
|
}
|
|
130682
130714
|
]
|
|
130683
130715
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {ExampleCodeBlock, SymbolDoc} from '@workday/canvas-kit-docs';
|
|
1
|
+
import {ExampleCodeBlock, Specifications, SymbolDoc} from '@workday/canvas-kit-docs';
|
|
2
2
|
import Basic from './examples/Basic';
|
|
3
3
|
import Alert from './examples/Alert';
|
|
4
4
|
import Error from './examples/Error';
|
|
@@ -27,6 +27,43 @@ by passing in `TextInput`, `Select`, `RadioGroup` and other form elements to `Fo
|
|
|
27
27
|
yarn add @workday/canvas-kit-react
|
|
28
28
|
```
|
|
29
29
|
|
|
30
|
+
## Accessibility
|
|
31
|
+
|
|
32
|
+
The `FormField` adds a `for` attribute to the `FormField.Label` (`<label>` element) element that
|
|
33
|
+
matches the `id` attribute of the `FormField.Input` which is usually a `input` element. This both
|
|
34
|
+
labels the input for screen readers and other assitive technology as well as will focus on the input
|
|
35
|
+
when the user clicks on the label. If your form field input component is more complicated, the
|
|
36
|
+
`FormField` will also add an `id` to the `FormField.Label` and an `aria-labelledby` to the
|
|
37
|
+
`FormField.Input` component. You can then forward the `aria-labelledby` to whatever elements you
|
|
38
|
+
need for the proper accessibility.
|
|
39
|
+
|
|
40
|
+
For example, the DOM will look something like this:
|
|
41
|
+
|
|
42
|
+
```html
|
|
43
|
+
<div>
|
|
44
|
+
<label id="label-abc" for="input-abc">First Name</label>
|
|
45
|
+
<input id="input-abc" aria-labelledby="label-abc" />
|
|
46
|
+
</div>
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Some components, like `MultiSelect`, have an additional `role=listbox` element that also needs to
|
|
50
|
+
link to the `label` element. The resulting DOM will look something like:
|
|
51
|
+
|
|
52
|
+
```html
|
|
53
|
+
<div>
|
|
54
|
+
<label id="label-abc" for="input-abc">States you've lived in</label>
|
|
55
|
+
<input id="input-abc" aria-labelledby="label-abc" role="combobox" ... />
|
|
56
|
+
<ul role="listbox" aria-labelledby="label-abc">
|
|
57
|
+
<li>Texas</li>
|
|
58
|
+
<li>California</li>
|
|
59
|
+
</ul>
|
|
60
|
+
</div>
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
The `MultiSelect` component gets the `aria-labelledby` from the `FormField.Input` and forwards it to
|
|
64
|
+
both the `input[role=combobox]` element and the `ul[role=listbox]` element so the screen reader
|
|
65
|
+
knows the label for both is "States you've lived in".
|
|
66
|
+
|
|
30
67
|
## Usage
|
|
31
68
|
|
|
32
69
|
### Basic
|
|
@@ -161,4 +198,8 @@ check our
|
|
|
161
198
|
|
|
162
199
|
## Component API
|
|
163
200
|
|
|
164
|
-
<SymbolDoc name="FormField" fileName="/preview-react/" />
|
|
201
|
+
<SymbolDoc name="FormField" fileName="/preview-react/" />
|
|
202
|
+
|
|
203
|
+
## Specifications
|
|
204
|
+
|
|
205
|
+
<Specifications file="FormField.spec.tsx" name="FormField" />
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@workday/canvas-kit-docs",
|
|
3
|
-
"version": "12.0.0-alpha.
|
|
3
|
+
"version": "12.0.0-alpha.907-next.0",
|
|
4
4
|
"description": "Documentation components of Canvas Kit components",
|
|
5
5
|
"author": "Workday, Inc. (https://www.workday.com)",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -44,10 +44,10 @@
|
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"@emotion/styled": "^11.6.0",
|
|
46
46
|
"@storybook/csf": "0.0.1",
|
|
47
|
-
"@workday/canvas-kit-labs-react": "^12.0.0-alpha.
|
|
48
|
-
"@workday/canvas-kit-preview-react": "^12.0.0-alpha.
|
|
49
|
-
"@workday/canvas-kit-react": "^12.0.0-alpha.
|
|
50
|
-
"@workday/canvas-kit-styling": "^12.0.0-alpha.
|
|
47
|
+
"@workday/canvas-kit-labs-react": "^12.0.0-alpha.907-next.0",
|
|
48
|
+
"@workday/canvas-kit-preview-react": "^12.0.0-alpha.907-next.0",
|
|
49
|
+
"@workday/canvas-kit-react": "^12.0.0-alpha.907-next.0",
|
|
50
|
+
"@workday/canvas-kit-styling": "^12.0.0-alpha.907-next.0",
|
|
51
51
|
"@workday/canvas-system-icons-web": "^3.0.0",
|
|
52
52
|
"@workday/canvas-tokens-web": "^2.0.1",
|
|
53
53
|
"markdown-to-jsx": "^7.2.0",
|
|
@@ -60,5 +60,5 @@
|
|
|
60
60
|
"mkdirp": "^1.0.3",
|
|
61
61
|
"typescript": "4.9"
|
|
62
62
|
},
|
|
63
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "3646c0ae53ba740d9e626c7f011925707644da84"
|
|
64
64
|
}
|