Skip to content

fix(ui): render DateTime label as <label> instead of <span> #12949

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

danicaleroo
Copy link

What / Why

Date & Time fields were rendering their field label as a <span> while every other field type uses a proper <label> with a matching htmlFor.

Because the element was a span it broke styles and made 'field-label' have different styles from the rest of 'field-label's.

Root cause: DateTimeField failed to pass its path (or an explicit htmlFor) to FieldLabel. When FieldLabel receives no htmlFor, it intentionally downgrades to a <span>.

Screenshots

Before

image
DateTime label rendered as <span>, causing style inconsistencies

After

image
DateTime label now rendered as proper <label> element

Changes introduced

  • packages/ui/src/fields/DateTime/index.tsx
    • Added path={path} prop to FieldLabel component

Behavior after the fix

  • Date-time labels are now real <label> elements with for="field-…"
  • Visual alignment now matches every other field type

How to test manually

  1. Run pnpm dev fields
  2. Inspect the DateTime field markup – label is now <label>
  3. Observe that vertical spacing matches other types of fields

@paulpopus paulpopus enabled auto-merge (squash) June 26, 2025 17:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants