@fluentui/react-card 9.0.0-beta.5 → 9.0.0-beta.6

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 (121) hide show
  1. package/CHANGELOG.json +152 -9
  2. package/CHANGELOG.md +33 -10
  3. package/README.md +3 -1
  4. package/Spec.md +523 -0
  5. package/assets/Card.png +0 -0
  6. package/assets/CardHeader.png +0 -0
  7. package/assets/CardPreview.png +0 -0
  8. package/assets/context-interaction-keyboard.png +0 -0
  9. package/assets/context-interaction-mouse.png +0 -0
  10. package/assets/context-narrator.png +0 -0
  11. package/assets/disabled-narrator.png +0 -0
  12. package/assets/disabled.png +0 -0
  13. package/assets/interactive-interaction-keyboard.png +0 -0
  14. package/assets/interactive-interaction-mouse.png +0 -0
  15. package/assets/interactive-narrator.png +0 -0
  16. package/assets/non-interactive-interaction-keyboard.png +0 -0
  17. package/assets/non-interactive-interaction-mouse.png +0 -0
  18. package/assets/non-interactive-narrator.png +0 -0
  19. package/assets/non-interactive-selectable-interaction-keyboard.png +0 -0
  20. package/assets/non-interactive-selectable-interaction-mouse.png +0 -0
  21. package/assets/selectable-interaction-keyboard.png +0 -0
  22. package/assets/selectable-interaction-mouse.png +0 -0
  23. package/assets/selectable-narrator.png +0 -0
  24. package/dist/react-card.d.ts +35 -49
  25. package/lib/components/Card/Card.js +6 -6
  26. package/lib/components/Card/Card.js.map +1 -1
  27. package/lib/components/Card/Card.types.d.ts +4 -5
  28. package/lib/components/Card/renderCard.d.ts +1 -1
  29. package/lib/components/Card/renderCard.js +3 -2
  30. package/lib/components/Card/renderCard.js.map +1 -1
  31. package/lib/components/Card/useCard.d.ts +3 -3
  32. package/lib/components/Card/useCard.js +3 -3
  33. package/lib/components/Card/useCard.js.map +1 -1
  34. package/lib/components/Card/useCardStyles.d.ts +1 -1
  35. package/lib/components/Card/useCardStyles.js +12 -6
  36. package/lib/components/Card/useCardStyles.js.map +1 -1
  37. package/lib/components/CardFooter/CardFooter.js +6 -6
  38. package/lib/components/CardFooter/CardFooter.js.map +1 -1
  39. package/lib/components/CardFooter/CardFooter.types.d.ts +3 -3
  40. package/lib/components/CardFooter/renderCardFooter.d.ts +1 -1
  41. package/lib/components/CardFooter/renderCardFooter.js +5 -4
  42. package/lib/components/CardFooter/renderCardFooter.js.map +1 -1
  43. package/lib/components/CardFooter/useCardFooter.d.ts +4 -8
  44. package/lib/components/CardFooter/useCardFooter.js +3 -8
  45. package/lib/components/CardFooter/useCardFooter.js.map +1 -1
  46. package/lib/components/CardFooter/useCardFooterStyles.d.ts +1 -1
  47. package/lib/components/CardFooter/useCardFooterStyles.js +5 -4
  48. package/lib/components/CardFooter/useCardFooterStyles.js.map +1 -1
  49. package/lib/components/CardHeader/CardHeader.js +6 -6
  50. package/lib/components/CardHeader/CardHeader.js.map +1 -1
  51. package/lib/components/CardHeader/CardHeader.types.d.ts +8 -8
  52. package/lib/components/CardHeader/renderCardHeader.d.ts +1 -1
  53. package/lib/components/CardHeader/renderCardHeader.js +9 -4
  54. package/lib/components/CardHeader/renderCardHeader.js.map +1 -1
  55. package/lib/components/CardHeader/useCardHeader.d.ts +4 -5
  56. package/lib/components/CardHeader/useCardHeader.js +3 -4
  57. package/lib/components/CardHeader/useCardHeader.js.map +1 -1
  58. package/lib/components/CardHeader/useCardHeaderStyles.d.ts +1 -1
  59. package/lib/components/CardHeader/useCardHeaderStyles.js +5 -4
  60. package/lib/components/CardHeader/useCardHeaderStyles.js.map +1 -1
  61. package/lib/components/CardPreview/CardPreview.js +6 -6
  62. package/lib/components/CardPreview/CardPreview.js.map +1 -1
  63. package/lib/components/CardPreview/CardPreview.types.d.ts +3 -3
  64. package/lib/components/CardPreview/renderCardPreview.d.ts +1 -1
  65. package/lib/components/CardPreview/renderCardPreview.js +5 -4
  66. package/lib/components/CardPreview/renderCardPreview.js.map +1 -1
  67. package/lib/components/CardPreview/useCardPreview.d.ts +4 -8
  68. package/lib/components/CardPreview/useCardPreview.js +3 -8
  69. package/lib/components/CardPreview/useCardPreview.js.map +1 -1
  70. package/lib/components/CardPreview/useCardPreviewStyles.d.ts +1 -1
  71. package/lib/components/CardPreview/useCardPreviewStyles.js +2 -2
  72. package/lib/components/CardPreview/useCardPreviewStyles.js.map +1 -1
  73. package/lib-commonjs/components/Card/Card.js +3 -3
  74. package/lib-commonjs/components/Card/Card.js.map +1 -1
  75. package/lib-commonjs/components/Card/Card.types.d.ts +4 -5
  76. package/lib-commonjs/components/Card/renderCard.d.ts +1 -1
  77. package/lib-commonjs/components/Card/renderCard.js +5 -4
  78. package/lib-commonjs/components/Card/renderCard.js.map +1 -1
  79. package/lib-commonjs/components/Card/useCard.d.ts +3 -3
  80. package/lib-commonjs/components/Card/useCard.js +5 -5
  81. package/lib-commonjs/components/Card/useCard.js.map +1 -1
  82. package/lib-commonjs/components/Card/useCardStyles.d.ts +1 -1
  83. package/lib-commonjs/components/Card/useCardStyles.js +17 -10
  84. package/lib-commonjs/components/Card/useCardStyles.js.map +1 -1
  85. package/lib-commonjs/components/CardFooter/CardFooter.js +3 -3
  86. package/lib-commonjs/components/CardFooter/CardFooter.js.map +1 -1
  87. package/lib-commonjs/components/CardFooter/CardFooter.types.d.ts +3 -3
  88. package/lib-commonjs/components/CardFooter/renderCardFooter.d.ts +1 -1
  89. package/lib-commonjs/components/CardFooter/renderCardFooter.js +7 -7
  90. package/lib-commonjs/components/CardFooter/renderCardFooter.js.map +1 -1
  91. package/lib-commonjs/components/CardFooter/useCardFooter.d.ts +4 -8
  92. package/lib-commonjs/components/CardFooter/useCardFooter.js +6 -11
  93. package/lib-commonjs/components/CardFooter/useCardFooter.js.map +1 -1
  94. package/lib-commonjs/components/CardFooter/useCardFooterStyles.d.ts +1 -1
  95. package/lib-commonjs/components/CardFooter/useCardFooterStyles.js +10 -9
  96. package/lib-commonjs/components/CardFooter/useCardFooterStyles.js.map +1 -1
  97. package/lib-commonjs/components/CardHeader/CardHeader.js +3 -3
  98. package/lib-commonjs/components/CardHeader/CardHeader.js.map +1 -1
  99. package/lib-commonjs/components/CardHeader/CardHeader.types.d.ts +8 -8
  100. package/lib-commonjs/components/CardHeader/renderCardHeader.d.ts +1 -1
  101. package/lib-commonjs/components/CardHeader/renderCardHeader.js +11 -7
  102. package/lib-commonjs/components/CardHeader/renderCardHeader.js.map +1 -1
  103. package/lib-commonjs/components/CardHeader/useCardHeader.d.ts +4 -5
  104. package/lib-commonjs/components/CardHeader/useCardHeader.js +6 -7
  105. package/lib-commonjs/components/CardHeader/useCardHeader.js.map +1 -1
  106. package/lib-commonjs/components/CardHeader/useCardHeaderStyles.d.ts +1 -1
  107. package/lib-commonjs/components/CardHeader/useCardHeaderStyles.js +11 -10
  108. package/lib-commonjs/components/CardHeader/useCardHeaderStyles.js.map +1 -1
  109. package/lib-commonjs/components/CardPreview/CardPreview.js +3 -3
  110. package/lib-commonjs/components/CardPreview/CardPreview.js.map +1 -1
  111. package/lib-commonjs/components/CardPreview/CardPreview.types.d.ts +3 -3
  112. package/lib-commonjs/components/CardPreview/renderCardPreview.d.ts +1 -1
  113. package/lib-commonjs/components/CardPreview/renderCardPreview.js +7 -7
  114. package/lib-commonjs/components/CardPreview/renderCardPreview.js.map +1 -1
  115. package/lib-commonjs/components/CardPreview/useCardPreview.d.ts +4 -8
  116. package/lib-commonjs/components/CardPreview/useCardPreview.js +6 -11
  117. package/lib-commonjs/components/CardPreview/useCardPreview.js.map +1 -1
  118. package/lib-commonjs/components/CardPreview/useCardPreviewStyles.d.ts +1 -1
  119. package/lib-commonjs/components/CardPreview/useCardPreviewStyles.js +7 -7
  120. package/lib-commonjs/components/CardPreview/useCardPreviewStyles.js.map +1 -1
  121. package/package.json +9 -11
package/Spec.md ADDED
@@ -0,0 +1,523 @@
1
+ # @fluentui/react-card Spec
2
+
3
+ ## Background
4
+
5
+ A card's main function is to provide the scaffolding for hosting actions and content for a single topic within a card sized object. It is a framework for organizing content within the confines of a card.
6
+
7
+ The card itself should not have content or actions built in, but provide the mechanisms for it to be displayed.
8
+
9
+ ### Fabric (v8)
10
+
11
+ Example:
12
+
13
+ ```jsx
14
+ <DocumentCard
15
+ aria-label="Default Document Card with large file name. Created by Annie Lindqvist a few minutes ago."
16
+ onClickHref="http://bing.com"
17
+ >
18
+ <DocumentCardPreview {...previewProps} />
19
+ <DocumentCardTitle title="Filename" />
20
+ <DocumentCardActivity activity="Created a few minutes ago" people={DocumentCardActivityPeople} />
21
+ </DocumentCard>
22
+ ```
23
+
24
+ ### Northstar (v0)
25
+
26
+ ```jsx
27
+ <Card>
28
+ <CardHeader>
29
+ <Flex gap="gap.small">
30
+ <Avatar
31
+ image="https://fabricweb.azureedge.net/fabric-website/assets/images/avatar/RobertTolbert.jpg"
32
+ label="Forward Division Analyst"
33
+ name="Lura Hermiston"
34
+ status="unknown"
35
+ />
36
+ <Flex column>
37
+ <Text content="Lura Hermiston" weight="bold" />
38
+ <Text content="Forward Division Analyst" size="small" />
39
+ </Flex>
40
+ </Flex>
41
+ </CardHeader>
42
+ <CardBody>Sit quaerat dolorem quos sit et dolorem asperiores.</CardBody>
43
+ </Card>
44
+ ```
45
+
46
+ ## Prior Art
47
+
48
+ - [Open UI research](https://github.com/openui/open-ui/pull/134)
49
+ - [Convergence epic](https://github.com/microsoft/fluentui/issues/19336)
50
+
51
+ ## Comparison of [Fabric DocumentCard](https://developer.microsoft.com/en-us/fluentui#/controls/web/documentcard) and [Northstar Card](https://fluentsite.z22.web.core.windows.net/0.57.0/components/card/definition)
52
+
53
+ Fabric's DocumentCard seems tied to a specific format, Office focused, while Northstar's Card is more generic.
54
+ DocumentCard has components for each specific need of a card that displays documents as it offers image previews/file lists, user activity and other related things.
55
+ Card goes for a more structural and generic approach to a card component and is closer to the vision for the v9 Card.
56
+
57
+ ### Components
58
+
59
+ | Purpose | Fabric | Northstar | Matching? |
60
+ | -------------------------------------------------------------------------------------------------------------------------- | -------------------- | ----------------- | --------- |
61
+ | Main component wrapper | DocumentCard | Card | ✅ |
62
+ | Component to add actions like sharing | DocumentCardActions | CardTopControls | ⚠️ |
63
+ | Component to render an image | DocumentCardImage | CardPreview | ⚠️ |
64
+ | Hybrid component to render an image preview for a document or list of documents. Possibly redundant with DocumentCardImage | DocumentCardPreview | | ❌ |
65
+ | Adds an icon/logo to the card | DocumentCardLogo | | ❌ |
66
+ | Wrapper for the right side of horizontal cards | DocumentCardDetails | | ❌ |
67
+ | Show document activity (user list) | DocumentCardActivity | | ❌ |
68
+ | Link element | DocumentCardLocation | | ❌ |
69
+ | Extra text component with a grayed out background | DocumentCardStatus | | ❌ |
70
+ | Header of the card | | CardHeader | ❌ |
71
+ | Body of the card | | CardBody | ❌ |
72
+ | Footer of the card | | CardFooter | ❌ |
73
+ | Wrapper to render in column format | | CardColumn | ❌ |
74
+ | Allows for content to expand on hover | | CardExpandableBox | ❌ |
75
+
76
+ ...
77
+
78
+ ## API Proposal
79
+
80
+ ### Components
81
+
82
+ | Component | Purpose |
83
+ | ----------- | ------------------------------------------------------------------------ |
84
+ | Card | Wrapper for the main content of a card. |
85
+ | CardHeader | Optional header slot for the card. |
86
+ | CardPreview | Previewing the document/article presented in the card through an image |
87
+ | CardFooter | Optional footer slot for the card. (non-applicable for horizontal cards) |
88
+
89
+ ### Card
90
+
91
+ #### Anatomy
92
+
93
+ ![visual anatomy of the Card component](./assets/Card.png)
94
+
95
+ #### DOM
96
+
97
+ ```HTML
98
+ <div role="group">
99
+ {children}
100
+ </div>
101
+ ```
102
+
103
+ #### API
104
+
105
+ | Property | Values | Default | Purpose |
106
+ | ----------- | ------------------------------------------------------------------------------------ | ---------- | ----------------------------------------------------------------------------------------------- |
107
+ | orientation | `vertical`, `horizontal` | `vertical` | Orientation of the card |
108
+ | size | `smallest`, `smaller`, `small`, `medium`, `large` | `medium` | Define the minimum size of the card. Smaller sizes only apply to horizontal card |
109
+ | scale | `fixed`, `auto-width`, `auto-height`, `auto`, `fluid-width`, `fluid-height`, `fluid` | `auto` | Manages how the card handles it's scaling depending on the content |
110
+ | appearance | `filled`, `filled-alternative`, `outline`, `subtle` | `filled` | Define the appearance of the card |
111
+ | selectable | boolean | false | Makes the card selectable by adding a checkbox to the _Actions_ area |
112
+ | selected | boolean | false | Set to `true` if card is selected |
113
+ | expandable | boolean | false | Allow card to expand to show whole content |
114
+ | disabled | boolean | false | Makes the card and card selection disabled (not propagated to children) |
115
+ | focusable | boolean \| 'noTab' \| 'tabExit' \| 'tabOnly' | false | Sets the focus behavior for the card. If `true`, the card will have the 'noTab' focus behavior. |
116
+
117
+ #### `scale` property
118
+
119
+ - `fixed`: Size of the card is fixed.
120
+ - `auto-width`: `width` is set to `fit-content`.
121
+ - `auto-height`: `height` is set to `fit-content`.
122
+ - `auto`: `width` and `height` are set to `fit-content`.
123
+ - `fluid-width`: `width` is set to `100%`.
124
+ - `fluid-height`: `height` is set to `100%`.
125
+ - `fluid`: `width` and `height` are set to `100%`.
126
+
127
+ #### `focusable` property
128
+
129
+ The three allowed focus behaviours (noTab, tabExit, tabOnly) map to the behaviors provided by Tabster.
130
+
131
+ - `noTab` (`trapFocus` in Tabster)
132
+
133
+ This behaviour traps the focus inside of the Card when pressing the `Enter` key and will only release focus when pressing the `Escape` key.
134
+
135
+ - `tabExit` (`limited` in Tabster)
136
+
137
+ This behaviour traps the focus inside of the Card when pressing the `Enter` key but will release focus when pressing the `Tab` key on the last inner element.
138
+
139
+ - `tabOnly` (`unlimited` in Tabster)
140
+
141
+ This behaviour will cycle through all elements inside of the Card when pressing the `Tab` key and then release focus after the last inner element.
142
+
143
+ #### Context menu
144
+
145
+ Context menu should be handled in conjunction with the @fluentui/react-menu component. A simple usage example would be:
146
+
147
+ ```jsx
148
+ <Menu openOnContext>
149
+ <MenuTrigger>
150
+ <Card />
151
+ </MenuTrigger>
152
+
153
+ <MenuPopover>
154
+ <MenuList>
155
+ <MenuItem>Share</MenuItem>
156
+ <MenuItem>Dismiss</MenuItem>
157
+ </MenuList>
158
+ </MenuPopover>
159
+ </Menu>
160
+ ```
161
+
162
+ `react-card` documentation will contain more elaborate examples to cover the different use cases.
163
+
164
+ ### CardHeader
165
+
166
+ #### Anatomy
167
+
168
+ ![visual anatomy of the CardHeader component](./assets/CardHeader.png)
169
+
170
+ #### DOM
171
+
172
+ ```HTML
173
+ <div>
174
+ <div>{image}</div>
175
+ <div>
176
+ {header}
177
+ {description}
178
+ </div>
179
+ </div>
180
+ ```
181
+
182
+ #### API
183
+
184
+ | Property | Values | Default | Purpose |
185
+ | ----------- | ------ | --------- | ------------------------------------------------- |
186
+ | image | _slot_ | undefined | Logo or image to better contextualize the content |
187
+ | header | _slot_ | undefined | Header of the card |
188
+ | description | _slot_ | undefined | Further description of the content |
189
+
190
+ ### CardPreview
191
+
192
+ #### Anatomy
193
+
194
+ ![visual anatomy of the CardPreview component](./assets/CardPreview.png)
195
+
196
+ #### DOM
197
+
198
+ ```HTML
199
+ <div>
200
+ {children}
201
+ <div>
202
+ {logo}
203
+ </div>
204
+ </div>
205
+ ```
206
+
207
+ #### API
208
+
209
+ | Property | Values | Default | Purpose |
210
+ | -------- | ------ | --------- | ---------------------------------------------- |
211
+ | logo | _slot_ | undefined | A logo/file type to add over the image preview |
212
+
213
+ ### CardFooter
214
+
215
+ #### Anatomy
216
+
217
+ This component has no custom props and only ensures the proper positioning of content and itself within the card.
218
+
219
+ #### DOM
220
+
221
+ ```HTML
222
+ <div>{children}</div>
223
+ ```
224
+
225
+ ## Sample Code
226
+
227
+ ### Compact
228
+
229
+ ```jsx
230
+ <Card orientation="horizontal">
231
+ <CardHeader image={<img src="powerpoint.png" />} header="Team offsite 2020" description="Onedrive > Files" />
232
+ </Card>
233
+ ```
234
+
235
+ ### App
236
+
237
+ ```jsx
238
+ <Card>
239
+ <CardHeader image={<img src="app_logo.png" />} header="App Name" description="Developer" />
240
+ <span>
241
+ Donut chocolate bar oat cake. Dragée tiramisu lollipop bear claw. Marshmallow pastry jujubes toffee sugar plum.
242
+ </span>
243
+ </Card>
244
+ ```
245
+
246
+ ### Task
247
+
248
+ ```jsx
249
+ <Card>
250
+ <CardHeader header="Alert in Teams when a new document is uploaded in channel" description="By Microsoft" />
251
+ <CardFooter>
252
+ <span>Automated</span>
253
+ <span>3290 uses</span>
254
+ </CardFooter>
255
+ </Card>
256
+ ```
257
+
258
+ ### Image
259
+
260
+ ```jsx
261
+ <Card>
262
+ <CardPreview src="monkey.png" alt="image of monkey" />
263
+ <div>
264
+ <span>Length</span>
265
+ <span>4.6-39.6 IN</span>
266
+ <span>11.7-100.6 cm</span>
267
+ </div>
268
+ <div>
269
+ <span>Diet</span>
270
+ <span>Omnivore</span>
271
+ <span>nuts, fruits, eggs</span>
272
+ </div>
273
+ <CardFooter>
274
+ <Button>Share</Button>
275
+ </CardFooter>
276
+ </Card>
277
+ ```
278
+
279
+ ## Behaviours
280
+
281
+ ### Mouse
282
+
283
+ ### Interactive cards
284
+
285
+ ![Visual interaction of interactive cards using the mouse](./assets/interactive-interaction-mouse.png)
286
+
287
+ The card surface can be used as a clickable target
288
+
289
+ 1. Rest
290
+
291
+ 2. OnHover
292
+
293
+ Cursor style changes to pointer, background color & elevation values change to show card is an actionable element
294
+
295
+ 3. OnClick
296
+
297
+ Executes action assigned to card i.e. “Open file, Open link in browser etc...”
298
+
299
+ ### Non-interactive cards with interactive child components
300
+
301
+ ![Visual interaction of non-interactive cards using the mouse](./assets/non-interactive-interaction-mouse.png)
302
+
303
+ Cards that have multiple actions within them cannot be clickable. We preserve the use of `EnterKey` for moving focus to actionable controls inside the card.
304
+
305
+ 1. OnMouseEnter / Hover
306
+
307
+ Cursor style stays at default, rest state stays persistent no visual feedback is applied to the card surface
308
+
309
+ 2. Hover & onClick
310
+
311
+ Hover state only applies to actionable items within card i.e. buttons, links etc. Cursor changes to pointer (or follows behavior of that component) ”
312
+
313
+ #### Selectable cards
314
+
315
+ ![Visual interaction of selectable cards using the mouse](./assets/selectable-interaction-mouse.png)
316
+
317
+ Clicking the card surface can toggle the checkbox state to `selected`. Note that checkboxes are composed together as an additional component and are not provided by default.
318
+
319
+ 1. Rest
320
+
321
+ Default state is `unselected`
322
+
323
+ 2. Hover
324
+
325
+ Cursor style changes to `pointer`, background color and elevation follows interactive styling to show visual feedback.
326
+
327
+ 3. Pressed
328
+
329
+ Cursor does not change background color and elevation follows interactive styling to show visual feedback for pressed state.
330
+
331
+ 4. onClick
332
+
333
+ Card and Checkbox are both in selected state, clicking again toggles components to unselected state.
334
+
335
+ ### Non-interactive selectable cards
336
+
337
+ ![Visual interaction of non-interactive selectable cards using the mouse](./assets/non-interactive-selectable-interaction-mouse.png)
338
+
339
+ Cards that have multiple actionable child components are expected to not be clickable. We preserve the use of `EnterKey` for moving focus to actionable controls inside the card, therefore the card surface should not be used to set the state of the card but is reliant on the checkbox or similar inputs to set the card state.
340
+
341
+ If users have a scenario that requires them to use actionable components within a clickable Card then the bubbling of events is expected to be managed by the users themselves.
342
+
343
+ If users have a scenario that requires them to use actionable components within a clickable Card then the bubbling of events is expected to be managed by the users themselves.
344
+
345
+ - OnMouseEnter / Hover
346
+
347
+ Cursor style stays at default, rest state stays persistent no visual feedback is applied to the card surface
348
+
349
+ - Hover & onClick (Checkbox)
350
+
351
+ Hover state & pressed state applies to checkbox component
352
+
353
+ - onClick (Checkbox)
354
+
355
+ Card and Checkbox are both in selected state, clicking again toggles components to unselected state
356
+
357
+ #### Disabled
358
+
359
+ ![Visual interaction of Disabled cards using the mouse](./assets/disabled.png)
360
+
361
+ In scenarios where a selectable card may be disabled both the card and the checkbox should be set to disabled.
362
+ Hovering the card changes the cursor style to not-allowed
363
+
364
+ 1. Unselected disabled
365
+
366
+ - Label: Selectable Card
367
+ - Role: Group
368
+ - State: Disabled, unselected
369
+
370
+ 2. Selected disabled
371
+
372
+ - Label: Selectable Card
373
+ - Role: Group
374
+ - State: Disabled, selected
375
+
376
+ ### Keyboard
377
+
378
+ ### Interactive cards
379
+
380
+ ![Visual interaction of interactive cards using the keyboard](./assets/interactive-interaction-keyboard.png)
381
+
382
+ 1. Rest
383
+
384
+ 2. Keyboard interaction
385
+
386
+ `EnterKey` Perfoms action on card “Open file, Open link in browser etc...”.
387
+
388
+ ### Non-interactive cards with interactive child components
389
+
390
+ ![Visual interaction of interactive cards using the keyboard](./assets/non-interactive-interaction-keyboard.png)
391
+
392
+ 1. Focus
393
+
394
+ Initial focus is set on card, to access items within the card use `EnterKey` or `Spacebar`.
395
+
396
+ 2. Focus-Inside
397
+
398
+ Focus moves to first actionable item in the card. Use `ArrowKeys` or `TabKey` to move focus to child elements within the card. To exit card use `EscKey`, to move focus back to card.
399
+
400
+ #### Selectable cards
401
+
402
+ ![Visual interaction of selectable cards using the keyboard](./assets/selectable-interaction-keyboard.png)
403
+
404
+ 1. Rest
405
+
406
+ Default state is ‘unselected’
407
+
408
+ 2. Focus
409
+
410
+ Focus rectangle is shown on card
411
+
412
+ 3. Focus
413
+
414
+ Use spacebar to toggle state (selected/unselected)
415
+
416
+ ### Non-interactive selectable cards
417
+
418
+ ![Visual interaction of non-interactive selectable cards using the keyboard](./assets/non-interactive-selectable-interaction-keyboard.png)
419
+
420
+ 1. Focus
421
+
422
+ Initial focus is set on card, to access items within the card use `EnterKey` or `Spacebar`.
423
+
424
+ 2. Focus-Inside
425
+
426
+ Focus moves to first actionable item in the card. Use `ArrowKeys` or `TabKey` to move focus to child elements within the card. To exit card use `EscKey`, to move focus back to card.
427
+
428
+ 3. Checkbox-Focus
429
+
430
+ Depending on your tab order of items within the card, the number of keystrokes will vary.
431
+
432
+ 4. `SpaceBar` or `EnterKey` while focused on the Checkbox
433
+
434
+ Will toggle both Card and Checkbox to selected state. Keying again will toggle to unselected.
435
+
436
+ ### Disabled
437
+
438
+ If a card is in a disabled state it should not receive focus from the tab order. And navigation to actionable child elements within the card should not be possible.
439
+
440
+ ## Accessibility
441
+
442
+ > ⚠️ Note: All other accessibility information, not covered in this section, is provided throughout the spec.
443
+
444
+ Each card is of `role="group"`.
445
+
446
+ ### Narrator guidance
447
+
448
+ ### Interactive cards
449
+
450
+ ![A card with the number 1 over it](./assets/interactive-narrator.png)
451
+
452
+ 1. Label: App Card
453
+ 2. Role: Group
454
+ 3. State: Focus
455
+ 4. Helper text: Use enterKey to perform action
456
+
457
+ #### Selectable cards
458
+
459
+ ![Visual interaction of keyboard usage with selectable cards](./assets/selectable-narrator.png)
460
+
461
+ 1 Focus + unselected
462
+
463
+ 1. Label: Select this card
464
+ 2. Role: Group
465
+ 3. State: Focus + unselected
466
+ 4. Helper text: Use enterKey or spacebar to toggle state to selected
467
+
468
+ 2 Focus + selected
469
+
470
+ 1. Label: Unselect this card
471
+ 2. Role: Group
472
+ 3. State: Focus + selected
473
+ 4. Helper text: Use enterKey or spacebar to toggle state to unselected
474
+
475
+ #### Non-interactive cards
476
+
477
+ ![Visual interaction of keyboard usage with non-interactive cards](./assets/non-interactive-narrator.png)
478
+
479
+ 1 Focus + unselected
480
+
481
+ 1. Label: App Card
482
+ 2. Role: Group
483
+ 3. State: Focus
484
+ 4. Helper text: Use enterKey to access controls within the card
485
+
486
+ 2 Focus (inside)
487
+
488
+ 1. Label: Open App
489
+ 2. Role: Button
490
+ 3. State: Focus
491
+ 4. Helper text: Use enterkey to open app in new window
492
+
493
+ 3 Focus Checkbox unselected
494
+
495
+ 1. Label: Share App
496
+ 2. Role: Button
497
+ 3. State: Focus
498
+ 4. Helper text: Use enter key to open share dialog
499
+
500
+ 4 Focus Checkbox selected
501
+
502
+ 1. Label: Select card
503
+ 2. Role: Checkbox
504
+ 3. State: Unselected
505
+ 4. Helper text: Use spacebar or enter key to select this item
506
+
507
+ #### Disabled
508
+
509
+ ![Two disabled cards. One is unselected and one is selected](./assets/disabled-narrator.png)
510
+
511
+ If a card is in a disabled state it should not receive focus from the tab order.
512
+
513
+ 1 Unselected disabled
514
+
515
+ 1. Label: Selectable Card
516
+ 2. Role: Group
517
+ 3. State: Disabled, unselected
518
+
519
+ 2 Selected disabled
520
+
521
+ 1. Label: Selectable Card
522
+ 2. Role: Group
523
+ 3. State: Disabled, selected
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file