1
- import React , { Fragment } from 'react' ;
1
+ import React from 'react' ;
2
2
import { Link } from 'react-router-dom' ;
3
3
4
4
import { GuideSectionTypes } from '../../../components' ;
5
5
import {
6
6
EuiDataGrid ,
7
7
EuiCode ,
8
8
EuiCallOut ,
9
- EuiBasicTable ,
10
- EuiSpacer ,
11
9
EuiText ,
12
10
EuiListGroupItem ,
13
11
} from '../../../../../src' ;
@@ -64,7 +62,7 @@ export const DataGridCellsExample = {
64
62
] ,
65
63
title : 'Cell actions' ,
66
64
text : (
67
- < Fragment >
65
+ < >
68
66
< p >
69
67
In addition to making a cell expandable, you can add more custom
70
68
actions by setting < EuiCode > columns.cellActions</ EuiCode > . These
@@ -97,7 +95,7 @@ export const DataGridCellsExample = {
97
95
< EuiCode > cellAction</ EuiCode > each, while the country column
98
96
provides 2 < EuiCode > cellAction</ EuiCode > s.
99
97
</ p >
100
- </ Fragment >
98
+ </ >
101
99
) ,
102
100
props : {
103
101
EuiDataGrid,
@@ -157,7 +155,7 @@ export const DataGridCellsExample = {
157
155
} ,
158
156
] ,
159
157
text : (
160
- < Fragment >
158
+ < >
161
159
< p >
162
160
< strong > EuiDataGrid</ strong > tracks and manages complicated focus
163
161
state management based upon the content of the individual inner
@@ -166,93 +164,44 @@ export const DataGridCellsExample = {
166
164
< h3 > Initial focus</ h3 >
167
165
< ul >
168
166
< li >
169
- When tabbing to the grid before it has received focus, the first
170
- cell of either the header (if it is interaction) or first content
167
+ When tabbing to the grid before it has received focus, the header
171
168
cell is focused.
172
169
</ li >
173
- < li > Datagrid does not auto-focus on mount / page load</ li >
174
170
< li >
175
- When removing focus from the grid and then returning, the last
176
- focused cell remains focused.
171
+ When tabbing away from the grid and then returning, the last
172
+ focused cell will regain focus.
173
+ </ li >
174
+ < li >
175
+ If the last focused cell has been scrolled out of view, the first
176
+ header cell receives focus instead.
177
177
</ li >
178
178
</ ul >
179
179
< h3 > Click and key events</ h3 >
180
180
< ul >
181
181
< li >
182
- Clicking on an interactive cell (not its content) should focus on
183
- the cell, or if it has only one interactive element the focus
184
- should shift to the element.
182
+ Clicking on an interactive cell or its content should focus on the
183
+ cell.
184
+ </ li >
185
+ < li >
186
+ The up, down, left, and right arrow keys can be pressed to
187
+ navigate between cells.
188
+ </ li >
189
+ < li >
190
+ For expandable cells, either the Enter or F2 keys can be pressed
191
+ interchangeably to toggle the cell popover. The Escape key will
192
+ close the popover.
185
193
</ li >
186
194
< li >
187
- Clicking on an interactive element within a cell the focus should
188
- always remain on that element, not shift to the cell or another
189
- element unless a subsequent user action changes it.
195
+ For non-expandable cells with interactive content, either the
196
+ Enter or F2 keys can be pressed to enter a focus trap, allowing
197
+ users to Tab between the cell's content. The Escape key will exit
198
+ the cell trap.
190
199
</ li >
191
200
< li >
192
- Enter or F2 can be used interchangeably to enter inner cell focus
193
- if the logic below allows it .
201
+ For non-expandable cells with no interactive content, the cell
202
+ alone will receive focus, with no inner content action .
194
203
</ li >
195
204
</ ul >
196
- < h3 >
197
- The content and expandability of the cells dictate the focus target
198
- of the cell
199
- </ h3 >
200
- < p >
201
- The following combinations of focus are maintained to provide for a
202
- good balance between accessibility and ease of use while navigating
203
- the grid with your keyboard.
204
- </ p >
205
- < EuiBasicTable
206
- columns = { [
207
- {
208
- field : 'expandable' ,
209
- name : 'Expandablity' ,
210
- } ,
211
- {
212
- field : 'contents' ,
213
- name : 'Cell contains' ,
214
- } ,
215
- {
216
- field : 'result' ,
217
- name : 'Resulting focus' ,
218
- width : '50%' ,
219
- mobileOptions : {
220
- width : '100%' ,
221
- } ,
222
- } ,
223
- ] }
224
- items = { [
225
- {
226
- id : '1' ,
227
- expandable : 'Not expandable' ,
228
- contents : 'No interactive elements' ,
229
- result :
230
- 'Cell alone receives the focus, with no possible inner focus action' ,
231
- } ,
232
- {
233
- id : '2' ,
234
- expandable : 'Not expandable' ,
235
- contents : 'Single interactive element' ,
236
- result :
237
- 'The single inner element within the cell receives focus' ,
238
- } ,
239
- {
240
- id : '3' ,
241
- expandable : 'Not expandable' ,
242
- contents : 'Multiple interactive elements' ,
243
- result :
244
- 'The cell will allow a non-expanding focus trap on Enter keyDown' ,
245
- } ,
246
- {
247
- id : '4' ,
248
- expandable : 'Is expandable' ,
249
- contents :
250
- 'Any combination of interactive / non-interactive elements' ,
251
- result : 'The cell will focus on the expansion action' ,
252
- } ,
253
- ] }
254
- />
255
- < EuiSpacer />
256
205
< EuiCallOut
257
206
color = "warning"
258
207
title = "Don't turn off cell expansion when the width of the column is unknown"
@@ -265,7 +214,7 @@ export const DataGridCellsExample = {
265
214
when you cannot control the width can lead to hidden focus because
266
215
the content is truncated.
267
216
</ EuiCallOut >
268
- </ Fragment >
217
+ </ >
269
218
) ,
270
219
demo : < DataGridFocus /> ,
271
220
} ,
0 commit comments