Skip to content

Commit 432ad9c

Browse files
Copilothotlong
andcommitted
fix: address code review — use cn() for class merging, strict equality, sr-only for a11y
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
1 parent 20148ae commit 432ad9c

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

packages/fields/src/widgets/RecordPickerDialog.tsx

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React, { useState, useEffect, useCallback, useRef, useMemo } from 'react';
22
import {
33
Button,
4+
cn,
45
Dialog,
56
DialogContent,
67
DialogHeader,
@@ -266,7 +267,7 @@ export function RecordPickerDialog({
266267
// Get display value for a cell
267268
const getCellValue = useCallback((record: any, field: string): string => {
268269
const val = record[field];
269-
if (val == null) return '';
270+
if (val === null || val === undefined) return '';
270271
if (typeof val === 'object') {
271272
// Handle MongoDB types / expanded references
272273
if (val.$numberDecimal) return String(Number(val.$numberDecimal));
@@ -282,7 +283,10 @@ export function RecordPickerDialog({
282283
<Dialog open={open} onOpenChange={onOpenChange}>
283284
<DialogContent className="max-w-2xl max-h-[80vh] flex flex-col" data-testid="record-picker-dialog">
284285
<DialogHeader>
285-
<DialogTitle>{title} {multiple && '(multiple)'}</DialogTitle>
286+
<DialogTitle>
287+
{title}
288+
{multiple && <span className="sr-only"> (multiple selection)</span>}
289+
</DialogTitle>
286290
</DialogHeader>
287291

288292
{/* Search bar */}
@@ -363,7 +367,10 @@ export function RecordPickerDialog({
363367
return (
364368
<TableRow
365369
key={rid ?? idx}
366-
className={`cursor-pointer ${selected ? 'bg-accent/50' : 'hover:bg-accent/30'}`}
370+
className={cn(
371+
'cursor-pointer',
372+
selected ? 'bg-accent/50' : 'hover:bg-accent/30',
373+
)}
367374
onClick={() => handleRowClick(record)}
368375
data-testid={`record-row-${rid}`}
369376
>

0 commit comments

Comments
 (0)