Skip to content

Commit d7f6dd5

Browse files
authored
[react-interactions] Fix typo in FocusTable (#16860)
1 parent cef47cb commit d7f6dd5

File tree

2 files changed

+19
-19
lines changed

2 files changed

+19
-19
lines changed

packages/react-interactions/accessibility/src/FocusTable.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ export function createFocusTable(): Array<React.Component> {
149149
onKeyDown(event: KeyboardEvent): void {
150150
const currentCell = scopeRef.current;
151151
switch (event.key) {
152-
case 'UpArrow': {
152+
case 'ArrowUp': {
153153
const [cells, rowIndex] = getRowCells(currentCell);
154154
if (cells !== null) {
155155
const [columns, columnIndex] = getRows(currentCell);
@@ -164,7 +164,7 @@ export function createFocusTable(): Array<React.Component> {
164164
}
165165
return;
166166
}
167-
case 'DownArrow': {
167+
case 'ArrowDown': {
168168
const [cells, rowIndex] = getRowCells(currentCell);
169169
if (cells !== null) {
170170
const [columns, columnIndex] = getRows(currentCell);
@@ -181,7 +181,7 @@ export function createFocusTable(): Array<React.Component> {
181181
}
182182
return;
183183
}
184-
case 'LeftArrow': {
184+
case 'ArrowLeft': {
185185
const [cells, rowIndex] = getRowCells(currentCell);
186186
if (cells !== null) {
187187
if (rowIndex > 0) {
@@ -192,7 +192,7 @@ export function createFocusTable(): Array<React.Component> {
192192
}
193193
return;
194194
}
195-
case 'RightArrow': {
195+
case 'ArrowRight': {
196196
const [cells, rowIndex] = getRowCells(currentCell);
197197
if (cells !== null) {
198198
if (rowIndex !== -1) {

packages/react-interactions/accessibility/src/__tests__/FocusTable-test.internal.js

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -116,35 +116,35 @@ describe('ReactFocusTable', () => {
116116
const a1 = createEventTarget(buttons[0]);
117117
a1.focus();
118118
a1.keydown({
119-
key: 'RightArrow',
119+
key: 'ArrowRight',
120120
});
121121
expect(document.activeElement.textContent).toBe('A2');
122122

123123
const a2 = createEventTarget(document.activeElement);
124124
a2.keydown({
125-
key: 'DownArrow',
125+
key: 'ArrowDown',
126126
});
127127
expect(document.activeElement.textContent).toBe('B2');
128128

129129
const b2 = createEventTarget(document.activeElement);
130130
b2.keydown({
131-
key: 'LeftArrow',
131+
key: 'ArrowLeft',
132132
});
133133
expect(document.activeElement.textContent).toBe('B1');
134134

135135
const b1 = createEventTarget(document.activeElement);
136136
b1.keydown({
137-
key: 'DownArrow',
137+
key: 'ArrowDown',
138138
});
139139
expect(document.activeElement.textContent).toBe('C1');
140140

141141
const c1 = createEventTarget(document.activeElement);
142142
c1.keydown({
143-
key: 'DownArrow',
143+
key: 'ArrowDown',
144144
});
145145
expect(document.activeElement.textContent).toBe('C1');
146146
c1.keydown({
147-
key: 'UpArrow',
147+
key: 'ArrowUp',
148148
});
149149
expect(document.activeElement.textContent).toBe('B1');
150150
});
@@ -201,55 +201,55 @@ describe('ReactFocusTable', () => {
201201
let a1 = createEventTarget(buttons[0]);
202202
a1.focus();
203203
a1.keydown({
204-
key: 'RightArrow',
204+
key: 'ArrowRight',
205205
});
206206
expect(document.activeElement.textContent).toBe('A2');
207207

208208
let a2 = createEventTarget(document.activeElement);
209209
a2.keydown({
210-
key: 'RightArrow',
210+
key: 'ArrowRight',
211211
});
212212
expect(document.activeElement.textContent).toBe('A3');
213213

214214
let a3 = createEventTarget(document.activeElement);
215215
a3.keydown({
216-
key: 'RightArrow',
216+
key: 'ArrowRight',
217217
});
218218
expect(document.activeElement.textContent).toBe('A1');
219219

220220
a1 = createEventTarget(document.activeElement);
221221
a1.keydown({
222-
key: 'RightArrow',
222+
key: 'ArrowRight',
223223
});
224224
expect(document.activeElement.textContent).toBe('A2');
225225

226226
a2 = createEventTarget(document.activeElement);
227227
a2.keydown({
228-
key: 'RightArrow',
228+
key: 'ArrowRight',
229229
});
230230
expect(document.activeElement.textContent).toBe('A3');
231231

232232
a3 = createEventTarget(document.activeElement);
233233
a3.keydown({
234-
key: 'RightArrow',
234+
key: 'ArrowRight',
235235
});
236236
expect(document.activeElement.textContent).toBe('A1');
237237

238238
a1 = createEventTarget(document.activeElement);
239239
a1.keydown({
240-
key: 'RightArrow',
240+
key: 'ArrowRight',
241241
});
242242
expect(document.activeElement.textContent).toBe('A2');
243243

244244
a2 = createEventTarget(document.activeElement);
245245
a2.keydown({
246-
key: 'RightArrow',
246+
key: 'ArrowRight',
247247
});
248248
expect(document.activeElement.textContent).toBe('A3');
249249

250250
a3 = createEventTarget(document.activeElement);
251251
a3.keydown({
252-
key: 'RightArrow',
252+
key: 'ArrowRight',
253253
});
254254
expect(document.activeElement.textContent).toBe('A3');
255255
});

0 commit comments

Comments
 (0)