Skip to content

feat(time): align Time with FE-7233 audit requirements#8052

Open
tamas-sage wants to merge 11 commits into
masterfrom
feat/fe-7233-time-input-audit
Open

feat(time): align Time with FE-7233 audit requirements#8052
tamas-sage wants to merge 11 commits into
masterfrom
feat/fe-7233-time-input-audit

Conversation

@tamas-sage

Copy link
Copy Markdown
Contributor

Proposed behaviour

Updates the Time component to match FE-7233 audit requirements by replacing NumberInput with Textbox, using internal Label/Fieldset patterns, applying numeric input mode, and updating time field labels to full words (e.g. “Hours”, “Minutes”) across locales. It also keeps AM/PM toggle optional and aligns disabled/read-only label styling with the new token approach.
image
image
image
image
image

Current behaviour

The Time component previously used NumberInput and legacy label styling, with abbreviated secondary labels (e.g. “Hrs.” / “Mins.” in some locales), and did not fully align with the latest audit token/pattern updates.

Checklist

  • Commits follow our style guide
  • Related issues linked in commit messages if required
  • Screenshots are included in the PR if useful
  • All themes are supported if required
  • Unit tests added or updated if required
  • Playwright automation tests added or updated if required
  • Storybook added or updated if required
  • Translations added or updated (including creating or amending translation keys table in storybook) if required
  • Typescript d.ts file added or updated if required
  • Related docs have been updated if required

QA

  • Tested in provided StackBlitz sandbox/Storybook
  • Add new Playwright test coverage if required
  • Carbon implementation matches Design System/designs
  • UI Tests GitHub check reviewed if required

Additional context

Testing instructions

@tamas-sage tamas-sage requested review from a team as code owners June 26, 2026 07:28
@tamas-sage tamas-sage marked this pull request as draft June 26, 2026 07:28
@tamas-sage tamas-sage self-assigned this Jun 26, 2026
Comment thread src/locales/en-gb.ts
pmText: () => "PM",
hoursLabelText: () => "Hrs.",
minutesLabelText: () => "Mins.",
hoursLabelText: () => "Hours",

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.

praise: good idea just replacing the string with the correct one instead of deleting this translation entirely, as it would have been a breaking change if used in consumers code

Comment thread src/components/time/time.component.tsx Outdated
@@ -16,9 +16,10 @@ import { filterStyledSystemMarginProps } from "../../style/utils";

import Fieldset from "../../__internal__/fieldset";

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.

suggestion: I believe we should be using the new Fieldset component here via ../../__internal__/__next__/

This will automatically give you the updated tokens for the legend, legent hint, required asterisk etc.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done ✅

id: hoursInputId,
label: hoursLabel,
"aria-label": hoursAriaLabel,
"aria-label": hoursInputAriaLabel,

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.

praise: hoursInputAriaLabel is definitely a better name here, makes it much clearer where the prop is being used

Comment thread src/components/time/time.pw.tsx Outdated
);

await checkAccessibility(page);
await checkAccessibility(page, undefined, "color-contrast");

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.

suggestion: I've tested this locally, and it appears to pass without the addition of this rule exception, same applies to the disabled test above so you can remove the colour contrast rule exception from there too if you'd like.

I believe since the test above was written aria-disabled has been added to elements with disabled styling which can't be natively disabled via the disabled attribute, so axe-core does not flag the component as having colour contrast issues 👍

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done ✅

Comment thread src/components/time/time.component.tsx
/** Override the default label text */
label?: string;
/** Override the default aria-label text */
/** Override the default aria-label text on the input */

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.

suggestion: if you're adding this to the prop description you should also add it to any other props within TimeInputProps for consistency sake

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done ✅

@nuria1110 nuria1110 self-requested a review June 26, 2026 10:28

@nuria1110 nuria1110 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.

Nice work on this, just a couple comments from me along with Tom's.

We will also need to deprecate label and inputHint and replace them with legend and legendHint, we will need to map them in the meantime so they still work.

legend={legend || label}
legendHint={legentHint || inputHint}

While aligning NumeralDate we found that is it not semantically correct to call it a label as its actually a legend so to be consistent we will have to do the same here, you can see how it was done here.

Comment thread src/components/time/time.component.tsx Outdated
Comment thread src/components/time/time.component.tsx
Comment thread src/components/time/time.test.tsx Outdated
Comment thread src/components/time/time.test.tsx Outdated
Comment thread src/components/time/time.test.tsx Outdated
Comment thread src/components/time/time.test.tsx Outdated
Comment thread src/components/time/time.style.ts Outdated
@tamas-sage tamas-sage requested a review from nuria1110 July 1, 2026 12:30
@tomdavies73 tomdavies73 marked this pull request as ready for review July 3, 2026 08:17
@tomdavies73 tomdavies73 requested a review from a team as a code owner July 3, 2026 08:17
@tomdavies73 tomdavies73 requested a review from a team as a code owner July 3, 2026 08:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

3 participants