@workday/canvas-kit-docs 14.0.7 → 14.0.9

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.
Files changed (24) hide show
  1. package/dist/es6/lib/docs.js +223 -107
  2. package/dist/es6/lib/stackblitzFiles/packageJSONFile.js +5 -5
  3. package/dist/es6/lib/stackblitzFiles/packageJSONFile.ts +5 -5
  4. package/dist/mdx/preview-react/segmented-control/SegmentedControl.mdx +27 -3
  5. package/dist/mdx/react/action-bar/ActionBar.mdx +10 -0
  6. package/dist/mdx/react/action-bar/examples/Basic.tsx +1 -1
  7. package/dist/mdx/react/action-bar/examples/DeleteAction.tsx +1 -1
  8. package/dist/mdx/react/action-bar/examples/Icons.tsx +1 -1
  9. package/dist/mdx/react/action-bar/examples/OverflowActionBar.tsx +1 -1
  10. package/dist/mdx/react/button/button/Button.mdx +38 -14
  11. package/dist/mdx/react/button/button/Hyperlink.mdx +36 -10
  12. package/dist/mdx/react/button/button/examples/Delete.tsx +4 -1
  13. package/dist/mdx/react/button/button/examples/ExternalHyperlink.tsx +1 -1
  14. package/dist/mdx/react/button/button/examples/ExternalHyperlinkInverse.tsx +1 -1
  15. package/dist/mdx/react/button/button/examples/HyperlinkInBodyText.tsx +2 -4
  16. package/dist/mdx/react/button/button/examples/Primary.tsx +4 -1
  17. package/dist/mdx/react/button/button/examples/PrimaryInverse.tsx +4 -1
  18. package/dist/mdx/react/button/button/examples/Secondary.tsx +4 -1
  19. package/dist/mdx/react/button/button/examples/SecondaryInverse.tsx +4 -1
  20. package/dist/mdx/react/button/button/examples/StandaloneHyperlink.tsx +5 -1
  21. package/dist/mdx/react/button/button/examples/Tertiary.tsx +4 -1
  22. package/dist/mdx/react/button/button/examples/TertiaryInverse.tsx +4 -1
  23. package/dist/mdx/react/menu/Menu.mdx +4 -0
  24. package/package.json +6 -6
@@ -437941,9 +437941,108 @@ export const docs = (typeof window !== 'undefined' && window.__docs) ||
437941
437941
  "name": "modifiers",
437942
437942
  "required": true,
437943
437943
  "type": {
437944
- "kind": "unknown",
437945
- "value": "unknown",
437946
- "text": "{[K in keyof M]?: MaybeBoolean<keyof M[K]>}"
437944
+ "kind": "conditional",
437945
+ "check": {
437946
+ "kind": "tuple",
437947
+ "value": [
437948
+ {
437949
+ "kind": "generic",
437950
+ "name": "E"
437951
+ }
437952
+ ]
437953
+ },
437954
+ "extends": {
437955
+ "kind": "tuple",
437956
+ "value": [
437957
+ {
437958
+ "kind": "primitive",
437959
+ "value": "never"
437960
+ }
437961
+ ]
437962
+ },
437963
+ "trueType": {
437964
+ "kind": "symbol",
437965
+ "name": "MappedBoolean",
437966
+ "typeParameters": [
437967
+ {
437968
+ "kind": "generic",
437969
+ "name": "M"
437970
+ }
437971
+ ],
437972
+ "value": "MappedBoolean<T>"
437973
+ },
437974
+ "falseType": {
437975
+ "kind": "conditional",
437976
+ "check": {
437977
+ "kind": "tuple",
437978
+ "value": [
437979
+ {
437980
+ "kind": "generic",
437981
+ "name": "E"
437982
+ }
437983
+ ]
437984
+ },
437985
+ "extends": {
437986
+ "kind": "tuple",
437987
+ "value": [
437988
+ {
437989
+ "kind": "symbol",
437990
+ "name": "BaseStencil",
437991
+ "typeParameters": [
437992
+ {
437993
+ "kind": "infer",
437994
+ "value": {
437995
+ "kind": "typeParameter",
437996
+ "name": "ME",
437997
+ "required": true
437998
+ }
437999
+ },
438000
+ {
438001
+ "kind": "primitive",
438002
+ "value": "any"
438003
+ },
438004
+ {
438005
+ "kind": "primitive",
438006
+ "value": "any"
438007
+ },
438008
+ {
438009
+ "kind": "primitive",
438010
+ "value": "any"
438011
+ },
438012
+ {
438013
+ "kind": "primitive",
438014
+ "value": "any"
438015
+ }
438016
+ ],
438017
+ "value": "BaseStencil<M, P, V, E, ID>"
438018
+ }
438019
+ ]
438020
+ },
438021
+ "trueType": {
438022
+ "kind": "symbol",
438023
+ "name": "MappedBoolean",
438024
+ "typeParameters": [
438025
+ {
438026
+ "kind": "intersection",
438027
+ "value": [
438028
+ {
438029
+ "kind": "generic",
438030
+ "name": "ME"
438031
+ },
438032
+ {
438033
+ "kind": "generic",
438034
+ "name": "M"
438035
+ }
438036
+ ]
438037
+ }
438038
+ ],
438039
+ "value": "MappedBoolean<T>"
438040
+ },
438041
+ "falseType": {
438042
+ "kind": "primitive",
438043
+ "value": "never"
438044
+ }
438045
+ }
437947
438046
  },
437948
438047
  "description": "",
437949
438048
  "declarations": [
@@ -437959,19 +438058,9 @@ export const docs = (typeof window !== 'undefined' && window.__docs) ||
437959
438058
  "name": "styles",
437960
438059
  "required": true,
437961
438060
  "type": {
437962
- "kind": "union",
437963
- "value": [
437964
- {
437965
- "kind": "symbol",
437966
- "name": "SerializedStyles",
437967
- "value": "SerializedStyles"
437968
- },
437969
- {
437970
- "kind": "symbol",
437971
- "name": "CSSObjectWithVars",
437972
- "value": "CSSObjectWithVars"
437973
- }
437974
- ]
438061
+ "kind": "symbol",
438062
+ "name": "StylesReturn",
438063
+ "value": "StylesReturn<P, V, E>"
437975
438064
  },
437976
438065
  "description": "",
437977
438066
  "declarations": [
@@ -437988,10 +438077,107 @@ export const docs = (typeof window !== 'undefined' && window.__docs) ||
437988
438077
  "kind": "typeParameter",
437989
438078
  "name": "M",
437990
438079
  "required": true
438080
+ },
438081
+ {
438082
+ "kind": "typeParameter",
438083
+ "name": "P",
438084
+ "constraint": {
438085
+ "kind": "external",
438086
+ "name": "Record",
438087
+ "url": "https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type",
438088
+ "typeParameters": [
438089
+ {
438090
+ "kind": "primitive",
438091
+ "value": "string"
438092
+ },
438093
+ {
438094
+ "kind": "primitive",
438095
+ "value": "string"
438096
+ }
438097
+ ]
438098
+ },
438099
+ "required": true
438100
+ },
438101
+ {
438102
+ "kind": "typeParameter",
438103
+ "name": "V",
438104
+ "defaultValue": {
438105
+ "kind": "object",
438106
+ "properties": []
438107
+ },
438108
+ "constraint": {
438109
+ "kind": "symbol",
438110
+ "name": "DefaultedVarsShape",
438111
+ "value": "DefaultedVarsShape"
438112
+ },
438113
+ "required": false
438114
+ },
438115
+ {
438116
+ "kind": "typeParameter",
438117
+ "name": "E",
438118
+ "defaultValue": {
438119
+ "kind": "primitive",
438120
+ "value": "never"
438121
+ },
438122
+ "constraint": {
438123
+ "kind": "symbol",
438124
+ "name": "BaseStencil",
438125
+ "typeParameters": [
438126
+ {
438127
+ "kind": "primitive",
438128
+ "value": "any"
438129
+ },
438130
+ {
438131
+ "kind": "primitive",
438132
+ "value": "any"
438133
+ },
438134
+ {
438135
+ "kind": "primitive",
438136
+ "value": "any"
438137
+ },
438138
+ {
438139
+ "kind": "primitive",
438140
+ "value": "any"
438141
+ },
438142
+ {
438143
+ "kind": "primitive",
438144
+ "value": "any"
438145
+ }
438146
+ ],
438147
+ "value": "BaseStencil<M, P, V, E, ID>"
438148
+ },
438149
+ "required": false
437991
438150
  }
437992
438151
  ]
437993
438152
  }
437994
438153
  },
438154
+ {
438155
+ "name": "MappedBoolean",
438156
+ "fileName": "/home/runner/work/canvas-kit/canvas-kit/modules/styling/lib/cs.ts",
438157
+ "description": "",
438158
+ "declarations": [
438159
+ {
438160
+ "name": "MappedBoolean",
438161
+ "filePath": "/home/runner/work/canvas-kit/canvas-kit/modules/styling/lib/cs.ts"
438162
+ }
438163
+ ],
438164
+ "tags": {},
438165
+ "type": {
438166
+ "kind": "type",
438167
+ "typeParameters": [
438168
+ {
438169
+ "kind": "typeParameter",
438170
+ "name": "T",
438171
+ "required": true
438172
+ }
438173
+ ],
438174
+ "value": {
438175
+ "kind": "unknown",
438176
+ "value": "unknown",
438177
+ "text": "{[K in keyof T]?: MaybeBoolean<keyof T[K]>}"
438178
+ }
438179
+ }
438180
+ },
437995
438181
  {
437996
438182
  "name": "StencilConfig",
437997
438183
  "fileName": "/home/runner/work/canvas-kit/canvas-kit/modules/styling/lib/cs.ts",
@@ -438099,101 +438285,27 @@ export const docs = (typeof window !== 'undefined' && window.__docs) ||
438099
438285
  "type": {
438100
438286
  "kind": "array",
438101
438287
  "value": {
438102
- "kind": "parenthesis",
438103
- "value": {
438104
- "kind": "conditional",
438105
- "check": {
438106
- "kind": "tuple",
438107
- "value": [
438108
- {
438109
- "kind": "generic",
438110
- "name": "E"
438111
- }
438112
- ]
438288
+ "kind": "symbol",
438289
+ "name": "StencilCompoundConfig",
438290
+ "typeParameters": [
438291
+ {
438292
+ "kind": "generic",
438293
+ "name": "M"
438113
438294
  },
438114
- "extends": {
438115
- "kind": "tuple",
438116
- "value": [
438117
- {
438118
- "kind": "primitive",
438119
- "value": "never"
438120
- }
438121
- ]
438295
+ {
438296
+ "kind": "generic",
438297
+ "name": "P"
438122
438298
  },
438123
- "trueType": {
438124
- "kind": "symbol",
438125
- "name": "StencilCompoundConfig",
438126
- "typeParameters": [
438127
- {
438128
- "kind": "generic",
438129
- "name": "M"
438130
- }
438131
- ],
438132
- "value": "StencilCompoundConfig<M>"
438299
+ {
438300
+ "kind": "generic",
438301
+ "name": "V"
438133
438302
  },
438134
- "falseType": {
438135
- "kind": "conditional",
438136
- "check": {
438137
- "kind": "generic",
438138
- "name": "E"
438139
- },
438140
- "extends": {
438141
- "kind": "symbol",
438142
- "name": "BaseStencil",
438143
- "typeParameters": [
438144
- {
438145
- "kind": "infer",
438146
- "value": {
438147
- "kind": "typeParameter",
438148
- "name": "ME",
438149
- "required": true
438150
- }
438151
- },
438152
- {
438153
- "kind": "primitive",
438154
- "value": "any"
438155
- },
438156
- {
438157
- "kind": "primitive",
438158
- "value": "any"
438159
- },
438160
- {
438161
- "kind": "primitive",
438162
- "value": "any"
438163
- },
438164
- {
438165
- "kind": "primitive",
438166
- "value": "any"
438167
- }
438168
- ],
438169
- "value": "BaseStencil<M, P, V, E, ID>"
438170
- },
438171
- "trueType": {
438172
- "kind": "symbol",
438173
- "name": "StencilCompoundConfig",
438174
- "typeParameters": [
438175
- {
438176
- "kind": "intersection",
438177
- "value": [
438178
- {
438179
- "kind": "generic",
438180
- "name": "ME"
438181
- },
438182
- {
438183
- "kind": "generic",
438184
- "name": "M"
438185
- }
438186
- ]
438187
- }
438188
- ],
438189
- "value": "StencilCompoundConfig<M>"
438190
- },
438191
- "falseType": {
438192
- "kind": "primitive",
438193
- "value": "never"
438194
- }
438303
+ {
438304
+ "kind": "generic",
438305
+ "name": "E"
438195
438306
  }
438196
- }
438307
+ ],
438308
+ "value": "StencilCompoundConfig<M, P, V, E>"
438197
438309
  }
438198
438310
  },
438199
438311
  "description": "Stencil compound modifiers. The styles of a compound modifier are returned only if each modifier\nmatches the specified value. For example:\n\n```tsx\nconst stencil = createStencil({\n base: {\n padding: 5,\n },\n modifiers: {\n size: {\n large: {\n padding: 10\n }\n },\n position: {\n start: {\n paddingInlineStart: 0\n }\n }\n },\n compound: [\n {\n modifiers: {\n size: 'large',\n position: 'start',\n },\n styles: {\n paddingInlineStart: 5\n }\n }\n ]\n})\n\nstencil({})\n// {padding: 5px;}\nstencil({size: 'large'})\n// {padding: 10px;}\nstencil({position: 'start' })\n// {padding: 5px; paddingInlineStart: 0}\nstencil({size: 'large', position: 'start' })\n// {padding: 10px; paddingInlineStart: 5px;}\n```",
@@ -439299,6 +439411,10 @@ export const docs = (typeof window !== 'undefined' && window.__docs) ||
439299
439411
  {
439300
439412
  "kind": "generic",
439301
439413
  "name": "V"
439414
+ },
439415
+ {
439416
+ "kind": "generic",
439417
+ "name": "E"
439302
439418
  }
439303
439419
  ],
439304
439420
  "value": "StencilModifierConfig<P, V, E>"
@@ -18,11 +18,11 @@ export const packageJSONFile = `{
18
18
  "@emotion/react": "11.11.4",
19
19
  "@types/react": "18.2.60",
20
20
  "@types/react-dom": "18.2.19",
21
- "@workday/canvas-kit-labs-react": "14.0.7",
22
- "@workday/canvas-kit-preview-react": "14.0.7",
23
- "@workday/canvas-kit-react": "14.0.7",
24
- "@workday/canvas-kit-react-fonts": "^14.0.7",
25
- "@workday/canvas-kit-styling": "14.0.7",
21
+ "@workday/canvas-kit-labs-react": "14.0.9",
22
+ "@workday/canvas-kit-preview-react": "14.0.9",
23
+ "@workday/canvas-kit-react": "14.0.9",
24
+ "@workday/canvas-kit-react-fonts": "^14.0.9",
25
+ "@workday/canvas-kit-styling": "14.0.9",
26
26
  "@workday/canvas-system-icons-web": "3.0.36",
27
27
  "@workday/canvas-tokens-web": "3.1.2"
28
28
  },
@@ -18,11 +18,11 @@ export const packageJSONFile = `{
18
18
  "@emotion/react": "11.11.4",
19
19
  "@types/react": "18.2.60",
20
20
  "@types/react-dom": "18.2.19",
21
- "@workday/canvas-kit-labs-react": "14.0.7",
22
- "@workday/canvas-kit-preview-react": "14.0.7",
23
- "@workday/canvas-kit-react": "14.0.7",
24
- "@workday/canvas-kit-react-fonts": "^14.0.7",
25
- "@workday/canvas-kit-styling": "14.0.7",
21
+ "@workday/canvas-kit-labs-react": "14.0.9",
22
+ "@workday/canvas-kit-preview-react": "14.0.9",
23
+ "@workday/canvas-kit-react": "14.0.9",
24
+ "@workday/canvas-kit-react-fonts": "^14.0.9",
25
+ "@workday/canvas-kit-styling": "14.0.9",
26
26
  "@workday/canvas-system-icons-web": "3.0.36",
27
27
  "@workday/canvas-tokens-web": "3.1.2"
28
28
  },
@@ -36,11 +36,35 @@ one button can be active at a time.
36
36
 
37
37
  <ExampleCodeBlock code={Basic} />
38
38
 
39
- Note that you must provide `SegmentedControl.List` with an `aria-label` prop for accessibility
40
- reasons.
41
-
42
39
  We **strongly** discourage including more than four buttons in a single `SegmentedControl`.
43
40
 
41
+ ### Accessibility
42
+
43
+ Our `SegmentedControl` component renders semantic HTML `<button>` elements to the browser DOM,
44
+ wrapped inside of a `<div>` with an explicit ARIA `role="group"`. This is equivalent to an HTML
45
+ `<fieldset>` element, and useful for screen readers to describe the relationship between the
46
+ buttons.
47
+
48
+ - Each button is a 2-state toggle button with `aria-pressed={true | false}` to indicate the current
49
+ state to screen readers.
50
+ - Providing your own `aria-label`string to `SegmentedControl.List` is recommended for describing the
51
+ purpose of the component.
52
+
53
+ #### Screen Reader Experience
54
+
55
+ When users interact with a `SegmentedControl` using screen readers:
56
+
57
+ - The group context is announced (e.g., "View options, group" when using
58
+ `aria-label="View options"`)
59
+ - Each button announces its text/label, "toggle button" role, and pressed/unpressed state (e.g.,
60
+ "List view, toggle button, pressed" or "Grid view, toggle button, not pressed")
61
+ - For icon-only buttons with tooltips, the tooltip text is announced along with the button role and
62
+ state
63
+ - When a button is activated, screen readers should announce the new state
64
+
65
+ Refer to [Button](?path=/docs/components-buttons--docs#accessibility) for more information about
66
+ accessibility of these components.
67
+
44
68
  ### Variations
45
69
 
46
70
  `SegmentedControl` supports three variations based on whether or not its `SegmentedControl.Item`
@@ -69,6 +69,16 @@ You can change it from the default of 3 to any number greater than 1 and less th
69
69
 
70
70
  <ExampleCodeBlock code={OverflowActionBarCustomButtonCount} />
71
71
 
72
+ ## Accessibility
73
+
74
+ Grouping the actions into an HTML `<section>` element with an `aria-label` string is recommended.
75
+ This can be useful for helping screen reader users quickly jump down to the actions at the bottom of
76
+ a page.
77
+
78
+ Refer to [Button](?path=/docs/components-buttons--docs#accessibility) and
79
+ [Menus](?path=/docs/components-popups-menu--docs#accessibility) for more information about
80
+ accessibiliy of these components in the Action Bar.
81
+
72
82
  ## Component API
73
83
 
74
84
  <SymbolDoc name="ActionBar" fileName="/react/" />
@@ -4,7 +4,7 @@ import {PrimaryButton} from '@workday/canvas-kit-react/button';
4
4
  export default () => {
5
5
  return (
6
6
  <ActionBar>
7
- <ActionBar.List position="relative" as="section" aria-label="Basic example actions">
7
+ <ActionBar.List position="relative" as="section" aria-label="Action Bar">
8
8
  <ActionBar.Item as={PrimaryButton} onClick={() => console.log('first action')}>
9
9
  First Action
10
10
  </ActionBar.Item>
@@ -4,7 +4,7 @@ import {DeleteButton} from '@workday/canvas-kit-react/button';
4
4
  export default () => {
5
5
  return (
6
6
  <ActionBar>
7
- <ActionBar.List position="relative" as="section" aria-label="Delete actions example">
7
+ <ActionBar.List position="relative" as="section" aria-label="Action Bar">
8
8
  <ActionBar.Item as={DeleteButton}>Delete Action</ActionBar.Item>
9
9
  <ActionBar.Item>Second Action</ActionBar.Item>
10
10
  </ActionBar.List>
@@ -5,7 +5,7 @@ import {PrimaryButton} from '@workday/canvas-kit-react/button';
5
5
  export default () => {
6
6
  return (
7
7
  <ActionBar>
8
- <ActionBar.List position="relative" as="section" aria-label="Icons example actions">
8
+ <ActionBar.List position="relative" as="section" aria-label="Action Bar">
9
9
  <ActionBar.Item as={PrimaryButton} icon={notificationsIcon}>
10
10
  First Action
11
11
  </ActionBar.Item>
@@ -29,7 +29,7 @@ export default () => {
29
29
  <ActionBar.List
30
30
  position="relative"
31
31
  as="section"
32
- aria-label="Overflow example actions"
32
+ aria-label="Action Bar"
33
33
  overflowButton={<ActionBar.OverflowButton aria-label="More actions" />}
34
34
  >
35
35
  {(item: MyActionItem, index) => (
@@ -4,8 +4,6 @@ import {
4
4
  SymbolDoc,
5
5
  SymbolDescription,
6
6
  } from '@workday/canvas-kit-docs';
7
- import {Pill} from '@workday/canvas-kit-preview-react/pill';
8
- import {accessibilityIcon} from '@workday/canvas-system-icons-web';
9
7
 
10
8
  import Primary from './examples/Primary';
11
9
  import PrimaryInverse from './examples/PrimaryInverse';
@@ -110,22 +108,48 @@ tokens with the fallback being `brand.primary.**`.
110
108
 
111
109
  ## Accessibility
112
110
 
113
- <Pill className="sb-unstyled">
114
- <Pill.Icon icon={accessibilityIcon} />
115
- <Pill.Label>WAI-ARIA Reference</Pill.Label>
116
- </Pill>
111
+ Our button components render semantic HTML `<button>` elements to the browser DOM. This means that
112
+ ARIA roles won't be necessary in most cases, and `onClick` listeners will automatically support the
113
+ Enter and Space keys for keyboard interactions.
117
114
 
118
- ### Accessible Use of the `as` Prop
115
+ [Button Pattern | APG | WAI | W3C](https://www.w3.org/WAI/ARIA/apg/patterns/button/)
119
116
 
120
- Like many of our components, Buttons accept an `as` prop, which lets you change the underlying
121
- semantic element - usually an `<a>`, or a `<button>`. This should be done with caution to ensure the
122
- best accessibility. Generally, `<button>` elements should be used for actions, and `<a>` elements
123
- should be used for navigation.
117
+ - An `aria-label` is only necessary for icon-only buttons in most cases. Using
118
+ [Canvas Kit's tooltip component](?path=/docs/components-popups-tooltip--docs) will handle this for
119
+ you, and all users will be able to see the label for the button.
120
+ - When button designs have 2 toggle states, an `aria-pressed={true | false}` property is required
121
+ for screen reader support. For example, see Canvas Kit's
122
+ [Segmented Control component](?path=/docs/preview-segmented-control--docs).
123
+ - When buttons have an attached menu, an `aria-haspopup=”true”` property is required. Using
124
+ [Canvas Kit's Menu component](?path=/docs/components-menus-menu--docs) will handle this for you.
125
+ - The icons used in text buttons are decorative in most cases and include ARIA `role="presentation"`
126
+ and `focusable="false"`. In some special cases where an icon does add meaning, you may be required
127
+ to change the `role` and add an `aria-label` to the icon for equivalent screen reader support.
124
128
 
125
- ### Role
129
+ ### Disabled Buttons
126
130
 
127
- By default buttons have a `role` of `button`. If you wish to use buttons in the context of a form,
128
- the role should be set to type `submit`.
131
+ - Disabled buttons use the `disabled` attribute, removing them from the tab order.
132
+ - Disabled styling is exempt from WCAG contrast requirements.
133
+
134
+ ### Screen Reader Experience
135
+
136
+ - Button text content is announced along with the button role (e.g., "Primary, button").
137
+ - Icon-only buttons announce the `aria-label` value along with the button role.
138
+ - Toggle buttons announce their pressed/unpressed state (e.g., "Activity Stream, toggle button,
139
+ pressed" and check out the
140
+ [Segmented Control component](?path=/docs/preview-segmented-control--docs)).
141
+
142
+ ### Touch Target Size
143
+
144
+ - All buttons meet the minimum 24px by 24px touch target size requirement for mobile accessibility.
145
+ - Button padding ensures adequate spacing between interactive elements to prevent accidental
146
+ activation.
147
+
148
+ ### Button Groups
149
+
150
+ - Related buttons can be grouped together with HTML unordered list elements or with `<fieldset>` and
151
+ `<legend>` elements. This can help give additional context to screen readers about the purpose of
152
+ the group.
129
153
 
130
154
  ## Component API
131
155
 
@@ -46,10 +46,40 @@ This variant can also be used with the `ExternalHyperlink` component.
46
46
 
47
47
  #### In Body Text
48
48
 
49
- In most cases use `HyperLink` and `ExternalHyperlink` in body text of a sentence where you need to link to another page or part of the document. By default they will wrap to a new line.
49
+ In most cases use `HyperLink` and `ExternalHyperlink` in body text of a sentence where you need to
50
+ link to another page or part of the document. By default they will wrap to a new line.
50
51
 
51
52
  <ExampleCodeBlock code={InBodyText} />
52
53
 
54
+ > **Accessibility Note:** Underlining links is not required in most cases. However, the example
55
+ > above is one such exception. When hyperlinked text appears inline with static text, a text
56
+ > decoration is required to avoid failing WCAG v2.2 success criterion 1.4.1 Use of Color.
57
+ >
58
+ > [Failure of Success Criterion 1.4.1 due to creating links that are not visually evident without color vision](https://www.w3.org/WAI/WCAG22/Techniques/failures/F73)
59
+
60
+ ### Accessibility
61
+
62
+ Our link components render semantic HTML `<a>` elements to the browser DOM. This means that ARIA
63
+ roles won't be necessary in most cases. The `href` prop is required for accessibility. Activation
64
+ links with the Enter key is standard expected behavior, while Space is only expected for buttons.
65
+
66
+ #### When to Use Links vs Buttons
67
+
68
+ - **Use Hyperlinks when:** Navigating to different pages or sections, or changing the browser's
69
+ location
70
+ - **Use Buttons when:** Performing actions like submitting forms, opening modals, or triggering
71
+ functions without navigation
72
+ - **Why This Matters:** Screen reader users expect different behaviors from links vs buttons. Users
73
+ navigate between links using different keyboard shortcuts than buttons. Browser behaviors like
74
+ "Open in new tab" only work with proper links.
75
+
76
+ #### Common Mistakes to Avoid
77
+
78
+ - Using buttons styled as links for navigation (breaks right-click context menus)
79
+ - Using links for actions like "Delete" or "Save" (confuses user expectations)
80
+ - Missing `href` attributes on navigation elements (breaks keyboard accessibility)
81
+ - Using `href="#"` with `onClick` handlers instead of proper buttons
82
+
53
83
  ### Component API
54
84
 
55
85
  <SymbolDoc name="Hyperlink" fileName="/react/" hideDescription hideHeading headingStart={4} />
@@ -57,8 +87,11 @@ In most cases use `HyperLink` and `ExternalHyperlink` in body text of a sentence
57
87
  ### ExternalHyperlink
58
88
 
59
89
  If your link should open in a new tab or window use the `ExternalHyperlink` component. It will let
60
- users know about the behavior by adding an icon, `extLinkIcon`. To ensure proper accessibility, you **must* provide a label to the icon via the `iconLabel` prop.
61
- This override will be needed for translations.
90
+ users know about the behavior by adding an icon, `extLinkIcon`.
91
+
92
+ > **Accessibility Note:** Providing a label to the icon via the `iconLabel` prop is required for
93
+ > accessibility because the icon adds meaning to the link text. We recommend keeping the alt text as
94
+ > concise as possible, such as "Opens new window". This override will be needed for translations.
62
95
 
63
96
  <ExampleCodeBlock code={ExternalLink} />
64
97
 
@@ -77,13 +110,6 @@ link on a dark or colorful background.
77
110
  headingStart={4}
78
111
  />
79
112
 
80
- ### Accessible Use of the `as` Prop
81
-
82
- Like many of our components, `Hyperlink` and `ExternalHyperlink` accept an `as` prop, which lets you
83
- change the underlying semantic element - usually an `<a>`, or a `<button>`. This should be done with
84
- caution to ensure the best accessibility. Generally, `<button>` elements should be used for actions,
85
- and `<a>` elements should be used for navigation.
86
-
87
113
  ## Specifications
88
114
 
89
115
  <Specifications file="Hyperlink.spec.ts" name="Hyperlink" />
@@ -3,6 +3,7 @@ import {Flex} from '@workday/canvas-kit-react/layout';
3
3
  import {trashIcon} from '@workday/canvas-system-icons-web';
4
4
  import {createStyles} from '@workday/canvas-kit-styling';
5
5
  import {system} from '@workday/canvas-tokens-web';
6
+ import {Tooltip} from '@workday/canvas-kit-react/tooltip';
6
7
 
7
8
  const parentContainerStyles = createStyles({
8
9
  gap: system.space.x4,
@@ -18,6 +19,8 @@ export default () => (
18
19
  <DeleteButton icon={trashIcon} iconPosition="end">
19
20
  Delete
20
21
  </DeleteButton>
21
- <DeleteButton aria-label="trash" icon={trashIcon} />
22
+ <Tooltip title="Delete">
23
+ <DeleteButton icon={trashIcon} />
24
+ </Tooltip>
22
25
  </Flex>
23
26
  );
@@ -1,7 +1,7 @@
1
1
  import {ExternalHyperlink} from '@workday/canvas-kit-react/button';
2
2
 
3
3
  export default () => (
4
- <ExternalHyperlink href="https://workday.com" iconLabel="Opens link in new window">
4
+ <ExternalHyperlink href="https://workday.com" iconLabel="Opens new window">
5
5
  External Hyperlink
6
6
  </ExternalHyperlink>
7
7
  );
@@ -24,7 +24,7 @@ export default () => (
24
24
  <ExternalHyperlink
25
25
  href="https://workday.com"
26
26
  variant="standaloneInverse"
27
- iconLabel="Opens link in new window"
27
+ iconLabel="Opens new window"
28
28
  >
29
29
  Hyperlink
30
30
  </ExternalHyperlink>
@@ -1,4 +1,4 @@
1
- import {ExternalHyperlink, Hyperlink} from '@workday/canvas-kit-react/button';
1
+ import {Hyperlink} from '@workday/canvas-kit-react/button';
2
2
 
3
3
  export default () => (
4
4
  <p>
@@ -6,9 +6,7 @@ export default () => (
6
6
  <Hyperlink href="#hyperlink">tempor incididunt</Hyperlink> ut labore et dolore magna aliqua. Ut
7
7
  enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
8
8
  consequat. Duis aute irure dolor in reprehenderit in
9
- <ExternalHyperlink href="#hyperlink">
10
- voluptate velit esse cillum dolore eu fugiat
11
- </ExternalHyperlink>
9
+ <Hyperlink href="#hyperlink">voluptate velit esse cillum dolore eu fugiat</Hyperlink>
12
10
  nulla pariatur.
13
11
  </p>
14
12
  );
@@ -7,6 +7,7 @@ import {
7
7
  } from '@workday/canvas-system-icons-web';
8
8
  import {createStyles} from '@workday/canvas-kit-styling';
9
9
  import {system} from '@workday/canvas-tokens-web';
10
+ import {Tooltip} from '@workday/canvas-kit-react/tooltip';
10
11
 
11
12
  const parentContainerStyles = createStyles({
12
13
  gap: system.space.x4,
@@ -22,6 +23,8 @@ export default () => (
22
23
  <PrimaryButton icon={caretDownIcon} iconPosition="end">
23
24
  Primary
24
25
  </PrimaryButton>
25
- <PrimaryButton aria-label="Related Actions" icon={relatedActionsVerticalIcon} />
26
+ <Tooltip title="Related Actions">
27
+ <PrimaryButton icon={relatedActionsVerticalIcon} />
28
+ </Tooltip>
26
29
  </Flex>
27
30
  );
@@ -9,6 +9,7 @@ import {
9
9
  } from '@workday/canvas-system-icons-web';
10
10
  import {createStyles} from '@workday/canvas-kit-styling';
11
11
  import {system} from '@workday/canvas-tokens-web';
12
+ import {Tooltip} from '@workday/canvas-kit-react/tooltip';
12
13
 
13
14
  const parentContainerStyles = createStyles({
14
15
  gap: system.space.x4,
@@ -25,6 +26,8 @@ export default () => (
25
26
  <PrimaryButton icon={caretDownIcon} iconPosition="end" variant="inverse">
26
27
  Primary
27
28
  </PrimaryButton>
28
- <PrimaryButton icon={relatedActionsVerticalIcon} variant="inverse" />
29
+ <Tooltip title="Related Actions">
30
+ <PrimaryButton icon={relatedActionsVerticalIcon} variant="inverse" />
31
+ </Tooltip>
29
32
  </Flex>
30
33
  );
@@ -9,6 +9,7 @@ import {
9
9
  } from '@workday/canvas-system-icons-web';
10
10
  import {createStyles} from '@workday/canvas-kit-styling';
11
11
  import {system} from '@workday/canvas-tokens-web';
12
+ import {Tooltip} from '@workday/canvas-kit-react/tooltip';
12
13
 
13
14
  const parentContainerStyles = createStyles({
14
15
  gap: system.space.x4,
@@ -24,6 +25,8 @@ export default () => (
24
25
  <SecondaryButton icon={caretDownIcon} iconPosition="end">
25
26
  Secondary
26
27
  </SecondaryButton>
27
- <SecondaryButton icon={relatedActionsVerticalIcon} />
28
+ <Tooltip title="Related Actions">
29
+ <SecondaryButton icon={relatedActionsVerticalIcon} />
30
+ </Tooltip>
28
31
  </Flex>
29
32
  );
@@ -9,6 +9,7 @@ import {
9
9
  } from '@workday/canvas-system-icons-web';
10
10
  import {createStyles} from '@workday/canvas-kit-styling';
11
11
  import {system} from '@workday/canvas-tokens-web';
12
+ import {Tooltip} from '@workday/canvas-kit-react/tooltip';
12
13
 
13
14
  const parentContainerStyles = createStyles({
14
15
  gap: system.space.x4,
@@ -25,6 +26,8 @@ export default () => (
25
26
  <SecondaryButton icon={caretDownIcon} variant="inverse" iconPosition="end">
26
27
  Secondary
27
28
  </SecondaryButton>
28
- <SecondaryButton icon={relatedActionsVerticalIcon} variant="inverse" />
29
+ <Tooltip title="Related Actions">
30
+ <SecondaryButton icon={relatedActionsVerticalIcon} variant="inverse" />
31
+ </Tooltip>
29
32
  </Flex>
30
33
  );
@@ -12,7 +12,11 @@ export default () => (
12
12
  <Hyperlink variant="standalone" href="#standalone-hyperlink">
13
13
  Standalone Hyperlink
14
14
  </Hyperlink>
15
- <ExternalHyperlink variant="standalone" href="#standalone-external-hyperlink">
15
+ <ExternalHyperlink
16
+ variant="standalone"
17
+ href="#standalone-external-hyperlink"
18
+ iconLabel="Opens new window"
19
+ >
16
20
  Standalone External Hyperlink
17
21
  </ExternalHyperlink>
18
22
  </div>
@@ -9,6 +9,7 @@ import {
9
9
  } from '@workday/canvas-system-icons-web';
10
10
  import {createStyles} from '@workday/canvas-kit-styling';
11
11
  import {system} from '@workday/canvas-tokens-web';
12
+ import {Tooltip} from '@workday/canvas-kit-react/tooltip';
12
13
 
13
14
  const parentContainerStyles = createStyles({
14
15
  gap: system.space.x4,
@@ -24,6 +25,8 @@ export default () => (
24
25
  <TertiaryButton icon={caretDownIcon} iconPosition="end">
25
26
  Tertiary
26
27
  </TertiaryButton>
27
- <TertiaryButton icon={relatedActionsVerticalIcon} />
28
+ <Tooltip title="Related Actions">
29
+ <TertiaryButton icon={relatedActionsVerticalIcon} />
30
+ </Tooltip>
28
31
  </Flex>
29
32
  );
@@ -9,6 +9,7 @@ import {
9
9
  } from '@workday/canvas-system-icons-web';
10
10
  import {createStyles} from '@workday/canvas-kit-styling';
11
11
  import {system} from '@workday/canvas-tokens-web';
12
+ import {Tooltip} from '@workday/canvas-kit-react/tooltip';
12
13
 
13
14
  const parentContainerStyles = createStyles({
14
15
  gap: system.space.x4,
@@ -25,6 +26,8 @@ export default () => (
25
26
  <TertiaryButton icon={caretDownIcon} iconPosition="end" variant="inverse">
26
27
  Tertiary
27
28
  </TertiaryButton>
28
- <TertiaryButton icon={relatedActionsVerticalIcon} variant="inverse" />
29
+ <Tooltip title="Related Actions">
30
+ <TertiaryButton icon={relatedActionsVerticalIcon} variant="inverse" />
31
+ </Tooltip>
29
32
  </Flex>
30
33
  );
@@ -104,6 +104,10 @@ submenus.
104
104
 
105
105
  <ExampleCodeBlock code={NestedDynamic} />
106
106
 
107
+ ## Accessibility
108
+
109
+ This content is coming soon!
110
+
107
111
  ## Component API
108
112
 
109
113
  <SymbolDoc name="Menu" fileName="/react/" />
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@workday/canvas-kit-docs",
3
- "version": "14.0.7",
3
+ "version": "14.0.9",
4
4
  "description": "Documentation components of Canvas Kit components",
5
5
  "author": "Workday, Inc. (https://www.workday.com)",
6
6
  "license": "Apache-2.0",
@@ -45,10 +45,10 @@
45
45
  "@emotion/styled": "^11.6.0",
46
46
  "@stackblitz/sdk": "^1.11.0",
47
47
  "@storybook/csf": "0.0.1",
48
- "@workday/canvas-kit-labs-react": "^14.0.7",
49
- "@workday/canvas-kit-preview-react": "^14.0.7",
50
- "@workday/canvas-kit-react": "^14.0.7",
51
- "@workday/canvas-kit-styling": "^14.0.7",
48
+ "@workday/canvas-kit-labs-react": "^14.0.9",
49
+ "@workday/canvas-kit-preview-react": "^14.0.9",
50
+ "@workday/canvas-kit-react": "^14.0.9",
51
+ "@workday/canvas-kit-styling": "^14.0.9",
52
52
  "@workday/canvas-system-icons-web": "^3.0.36",
53
53
  "@workday/canvas-tokens-web": "^3.1.1",
54
54
  "markdown-to-jsx": "^7.2.0",
@@ -61,5 +61,5 @@
61
61
  "mkdirp": "^1.0.3",
62
62
  "typescript": "5.0"
63
63
  },
64
- "gitHead": "1362528f8969a50b9f0e34b13e1c32fef5aa1040"
64
+ "gitHead": "63f17c093376eb1d2ad11be8f9c5340a4d9a71df"
65
65
  }