Skip to content

Commit 3bd481a

Browse files
Select row when focusing on elements inside (#525)
1 parent 96ac700 commit 3bd481a

File tree

1 file changed

+32
-30
lines changed

1 file changed

+32
-30
lines changed

src/components/DataSamplesTableRow.tsx

Lines changed: 32 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
import { GridItem, Text, useDisclosure } from "@chakra-ui/react";
1+
import { Box, GridItem, Text, useDisclosure } from "@chakra-ui/react";
22
import { FormattedMessage, useIntl } from "react-intl";
3-
import { ActionData } from "../model";
4-
import { useStore } from "../store";
5-
import DataSamplesTableHints from "./DataSamplesTableHints";
6-
import { ConfirmDialog } from "./ConfirmDialog";
7-
import ActionDataSamplesCard from "./ActionDataSamplesCard";
8-
import ActionNameCard from "./ActionNameCard";
93
import {
104
ConnectionFlowStep,
115
useConnectionStage,
126
} from "../connection-stage-hooks";
7+
import { ActionData } from "../model";
8+
import { useStore } from "../store";
9+
import ActionDataSamplesCard from "./ActionDataSamplesCard";
10+
import ActionNameCard from "./ActionNameCard";
11+
import { ConfirmDialog } from "./ConfirmDialog";
12+
import DataSamplesTableHints from "./DataSamplesTableHints";
1313
import { RecordingOptions } from "./RecordingDialog";
1414

1515
interface DataSamplesTableRowProps {
@@ -59,31 +59,33 @@ const DataSamplesTableRow = ({
5959
onConfirm={() => deleteAction(action.ID)}
6060
onCancel={deleteConfirmDisclosure.onClose}
6161
/>
62-
<GridItem>
63-
<ActionNameCard
64-
value={action}
65-
onDeleteAction={deleteConfirmDisclosure.onOpen}
66-
onSelectRow={onSelectRow}
67-
selected={selected}
68-
readOnly={false}
69-
/>
70-
</GridItem>
71-
{showHints ? (
72-
<DataSamplesTableHints action={action} onRecord={onRecord} />
73-
) : (
62+
<Box display="contents" onFocusCapture={onSelectRow}>
7463
<GridItem>
75-
{(action.name.length > 0 || action.recordings.length > 0) && (
76-
<ActionDataSamplesCard
77-
newRecordingId={newRecordingId}
78-
value={action}
79-
selected={selected}
80-
onSelectRow={onSelectRow}
81-
onRecord={onRecord}
82-
clearNewRecordingId={clearNewRecordingId}
83-
/>
84-
)}
64+
<ActionNameCard
65+
value={action}
66+
onDeleteAction={deleteConfirmDisclosure.onOpen}
67+
onSelectRow={onSelectRow}
68+
selected={selected}
69+
readOnly={false}
70+
/>
8571
</GridItem>
86-
)}
72+
{showHints ? (
73+
<DataSamplesTableHints action={action} onRecord={onRecord} />
74+
) : (
75+
<GridItem>
76+
{(action.name.length > 0 || action.recordings.length > 0) && (
77+
<ActionDataSamplesCard
78+
newRecordingId={newRecordingId}
79+
value={action}
80+
selected={selected}
81+
onSelectRow={onSelectRow}
82+
onRecord={onRecord}
83+
clearNewRecordingId={clearNewRecordingId}
84+
/>
85+
)}
86+
</GridItem>
87+
)}
88+
</Box>
8789
</>
8890
);
8991
};

0 commit comments

Comments
 (0)