Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
"name": "forms",
"version": "0.2.0",
"private": true,
"workspaces": ["apps/*", "packages/*"],
"workspaces": [
"apps/*",
"packages/*"
],
"scripts": {
"start": "yarn dev",
"dev": "turbo run dev",
Expand Down
2 changes: 1 addition & 1 deletion packages/components/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@lambdacurry/forms",
"version": "0.19.4",
"version": "0.19.5",
"type": "module",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
Expand Down
7 changes: 6 additions & 1 deletion packages/components/src/ui/form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,14 @@ export function FormControl({ Component, ...props }: FormControlProps) {
const computedDescriptionId = fromPropsDesc ?? context.formDescriptionId;
const computedMessageId = fromPropsMsg ?? context.formMessageId;

// Fix: Only include aria-describedby if there's an error or description
const ariaDescribedBy = [];
if (computedDescriptionId) ariaDescribedBy.push(computedDescriptionId);
if (error && computedMessageId) ariaDescribedBy.push(computedMessageId);

const ariaProps = {
id: computedId,
'aria-describedby': error ? `${computedDescriptionId} ${computedMessageId}` : computedDescriptionId,
...(ariaDescribedBy.length > 0 ? { 'aria-describedby': ariaDescribedBy.join(' ') } : {}),
'aria-invalid': !!error,
} as const;

Expand Down