Skip to content

fix(ui-date-input,ui-text-input): label the input with aria-labelledby - #2730

Merged
HerrTopi merged 1 commit into
masterfrom
dateinput-label
Oct 2, 2026
Merged

HerrTopi merged 1 commit into
masterfrom
dateinput-label

Conversation

@HerrTopi

@HerrTopi HerrTopi commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • DateInput v2 passed aria-label={callRenderProp(renderLabel)}, so when renderLabel was a node, the toString conversion broke . It now points aria-labelledby at the real label element.
  • TextInput v2 accepts an optional labelId to override its generated label id, falling back to deterministicId('TextInput-label').

Test Plan

  • Screen reader on DateInput with a node renderLabel (e.g. renderLabel={<Text>Date</Text>}): the field should announce the label text, not [object Object].
  • Confirm the label id lands on the rendered label and matches the input's aria-labelledby in the DOM.
  • Spot-check TextInput callers that pass their own aria-labelledby — a consumer value still wins over the generated id.

Fixes INSTUI-5193

🤖 ONLY THE TEXT ABOVE IS PARTIALLY Generated with Claude Code Otherwise the code is human generated

DateInput passed `aria-label={callRenderProp(renderLabel)}` to TextInput. When `renderLabel` is a
node rather than a string, `callRenderProp` returns a React element, so the input advertised an
object as its accessible name instead of readable text.

DateInput now generates a deterministic id, hands it to TextInput as `labelId`, and points
`aria-labelledby` at it, so the input is labelled by the real rendered label element.

TextInput v2 gains an optional `labelId` prop that overrides its generated label id. It falls back
to the previous `deterministicId('TextInput-label')` value when omitted, so existing callers are
unaffected.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@HerrTopi HerrTopi self-assigned this Sep 24, 2026
@github-actions

github-actions Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor
PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-10-02 13:49 UTC

@HerrTopi
HerrTopi requested review from balzss and matyasf September 24, 2026 12:37
@github-actions

Copy link
Copy Markdown
Contributor

Visual regression report

Cypress suite: ✅ Passing

Visual diff: ✅ No changes.

Status Count
Unchanged 99
Changed 0
New 0
Removed 0

Accessibility (axe): ✅ No violations.

📊 View full report — click a screenshot's ⚠ badge to see each violation boxed on the image, with the offending element named and contrast failures shown as color swatches.

Baselines come from the visual-baselines branch. They refresh on every merge to master. The Cypress suite line covers the a11y and console-error assertions — a ❌ there means the suite found real issues even if the visual diff is clean.

github-actions Bot pushed a commit that referenced this pull request Sep 24, 2026
@HerrTopi
HerrTopi requested review from joyenjoyer and removed request for balzss September 29, 2026 08:39

@matyasf matyasf left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good!

@HerrTopi
HerrTopi requested a review from balzss October 2, 2026 00:19

@joyenjoyer joyenjoyer left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good

@balzss balzss left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one question and a nitpick, otherwise it looks ok

}

const selectedDate = parseDate(value)[1]
const labelId = useDeterministicId('TextInput-label')()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this intentionally TextInput and not DateInput?

id?: string

/**
* id for the label. If empty, it's auto generated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: i'd expand on the explanation a bit further: what id, what label, where, how. doesnt need to be too verbose but i'm not sure if it's obvious why would someone use this

@HerrTopi
HerrTopi merged commit 5e30958 into master Oct 2, 2026
10 checks passed
@HerrTopi
HerrTopi deleted the dateinput-label branch October 2, 2026 13:48
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.

4 participants