Skip to content

Commit 601e8cc

Browse files
committed
fixed the down arrow press to focus the column rows.
1 parent 67f1451 commit 601e8cc

3 files changed

Lines changed: 9 additions & 22 deletions

File tree

packages/@adobe/react-spectrum/test/table/TableTests.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1369,6 +1369,13 @@ export let tableTests = () => {
13691369
expect(document.activeElement).toBe(getCell(tree, 'Bar 1'));
13701370
});
13711371

1372+
it('should move focus from a focused column header to the first row cell with ArrowDown when initialFocus="columnheader"', function () {
1373+
let tree = renderTable('en-US', {initialFocus: 'columnheader'});
1374+
focusCell(tree, 'Foo');
1375+
moveFocus('ArrowDown');
1376+
expect(document.activeElement).toBe(getCell(tree, 'Foo 1'));
1377+
});
1378+
13721379
it('should allow the user to focus disabled cells', function () {
13731380
let tree = renderTable('en-US', {disabledKeys: ['Foo 2']});
13741381
focusCell(tree, 'Bar 1');

packages/react-aria-components/stories/Table.stories.tsx

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -995,11 +995,6 @@ const InitialFocusExample = (args: {
995995
<div style={{display: 'flex', flexDirection: 'column', gap: 8}}>
996996
<Table aria-label="Files" {...args}>
997997
<TableHeader>
998-
{args.selectionMode !== 'none' && (
999-
<Column>
1000-
<MyCheckbox slot="selection" />
1001-
</Column>
1002-
)}
1003998
<Column isRowHeader allowsSorting>
1004999
Name
10051000
</Column>
@@ -1008,31 +1003,16 @@ const InitialFocusExample = (args: {
10081003
</TableHeader>
10091004
<TableBody>
10101005
<Row id="1">
1011-
{args.selectionMode !== 'none' && (
1012-
<Cell>
1013-
<MyCheckbox slot="selection" />
1014-
</Cell>
1015-
)}
10161006
<Cell>Games</Cell>
10171007
<Cell>File folder</Cell>
10181008
<Cell>6/7/2020</Cell>
10191009
</Row>
10201010
<Row id="2">
1021-
{args.selectionMode !== 'none' && (
1022-
<Cell>
1023-
<MyCheckbox slot="selection" />
1024-
</Cell>
1025-
)}
10261011
<Cell>Program Files</Cell>
10271012
<Cell>File folder</Cell>
10281013
<Cell>4/7/2021</Cell>
10291014
</Row>
10301015
<Row id="3">
1031-
{args.selectionMode !== 'none' && (
1032-
<Cell>
1033-
<MyCheckbox slot="selection" />
1034-
</Cell>
1035-
)}
10361016
<Cell>bootmgr</Cell>
10371017
<Cell>System file</Cell>
10381018
<Cell>11/20/2010</Cell>
@@ -1044,7 +1024,7 @@ const InitialFocusExample = (args: {
10441024

10451025
export const InitialFocusExampleStory: StoryObj<typeof InitialFocusExample> = {
10461026
render: InitialFocusExample,
1047-
name: 'initialFocus="columnheader" with selection checkbox column',
1027+
name: 'initialFocus="columnheader"',
10481028
args: {
10491029
initialFocus: 'columnheader',
10501030
selectionMode: 'multiple'

packages/react-aria/src/table/TableKeyboardDelegate.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ export class TableKeyboardDelegate<T> extends GridKeyboardDelegate<T, ITableColl
6565
return child.key;
6666
}
6767

68-
let firstKey = this.getFirstKey();
68+
let firstKey = super.getFirstKey();
6969
if (firstKey == null) {
7070
return null;
7171
}

0 commit comments

Comments
 (0)