Skip to content

Commit 8535939

Browse files
Copilothotlong
andcommitted
fix: improve completion field detection and add accessibility attributes
- Use exact field name matching to prevent false positives - Add role="img" and aria-label to completion indicators Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
1 parent cf06ff3 commit 8535939

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

packages/fields/src/index.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -253,20 +253,20 @@ export function BooleanCellRenderer({ value, field }: CellRendererProps): React.
253253
}
254254

255255
// Semantic rendering for completion fields (green circle indicator)
256+
// Only match exact field names to avoid false positives
256257
const fieldName = field?.name?.toLowerCase() || '';
257-
const isCompletionField = ['completed', 'is_completed', 'done', 'is_done'].some(
258-
f => fieldName === f || fieldName.endsWith(`_${f}`)
259-
);
258+
const isCompletionField = fieldName === 'completed' || fieldName === 'is_completed'
259+
|| fieldName === 'done' || fieldName === 'is_done';
260260

261261
if (isCompletionField) {
262262
return (
263263
<div className="flex items-center justify-center">
264264
{value ? (
265-
<div className="size-5 rounded-full bg-green-500 flex items-center justify-center" data-testid="completion-indicator">
265+
<div className="size-5 rounded-full bg-green-500 flex items-center justify-center" role="img" aria-label="Completed" data-testid="completion-indicator">
266266
<Check className="size-3 text-white" />
267267
</div>
268268
) : (
269-
<div className="size-5 rounded-full border-2 border-muted-foreground/30" data-testid="completion-indicator" />
269+
<div className="size-5 rounded-full border-2 border-muted-foreground/30" role="img" aria-label="Not completed" data-testid="completion-indicator" />
270270
)}
271271
</div>
272272
);

0 commit comments

Comments
 (0)