Skip to content

Conversation

@anuanto966
Copy link
Contributor

@anuanto966 anuanto966 commented Oct 27, 2025

Fixed Timepicker components in both React and Web Components to not show invalid/warn states when in disabled or readonly state, as users cannot interact with these components in those states.

Closes #20727

Changelog

Changed

  • Instead of using readOnly state to check if should display warnings or not, Time Picker now also checks if component is disabled. This way, warnings will not be shown if the component is disabled/readOnly.

Testing / Reviewing

  • Access the Slider playground on storybook (/?path=/story/components-time-picker--default) and change the state to "Invalid = true" and "disabled = true". The invalid message should not be shown.
  • Repeat above test with "readOnly = true" instead of disabled. The invalid message should not be shown.
  • Repeat the two tests above using "warn = true" instead of "invalid = true". The warning message on both scenarios should not be shown.

PR Checklist

As the author of this PR, before marking ready for review, confirm you:

  • Reviewed every line of the diff
  • Updated documentation and storybook examples
  • Wrote passing tests that cover this change
  • Addressed any impact on accessibility (a11y)
  • Tested for cross-browser consistency
  • Validated that this code is ready for review and status checks should pass

More details can be found in the pull request guide

@netlify
Copy link

netlify bot commented Oct 27, 2025

Deploy Preview for v11-carbon-web-components ready!

Name Link
🔨 Latest commit 3108f98
🔍 Latest deploy log https://app.netlify.com/projects/v11-carbon-web-components/deploys/690c0a57b55dee0008b7a918
😎 Deploy Preview https://deploy-preview-20818--v11-carbon-web-components.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify
Copy link

netlify bot commented Oct 27, 2025

Deploy Preview for carbon-elements ready!

Name Link
🔨 Latest commit 3108f98
🔍 Latest deploy log https://app.netlify.com/projects/carbon-elements/deploys/690c0a57dd9975000878aa18
😎 Deploy Preview https://deploy-preview-20818--carbon-elements.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@codecov
Copy link

codecov bot commented Oct 27, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.39%. Comparing base (7a12453) to head (3108f98).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #20818      +/-   ##
==========================================
+ Coverage   92.33%   92.39%   +0.06%     
==========================================
  Files         511      511              
  Lines       37341    37352      +11     
  Branches     5677     5747      +70     
==========================================
+ Hits        34478    34511      +33     
+ Misses       2715     2692      -23     
- Partials      148      149       +1     
Flag Coverage Δ
main-packages 85.53% <100.00%> (+0.04%) ⬆️
web-components 96.73% <100.00%> (+0.07%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@netlify
Copy link

netlify bot commented Oct 27, 2025

Deploy Preview for v11-carbon-react ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 3108f98
🔍 Latest deploy log https://app.netlify.com/projects/v11-carbon-react/deploys/690c0a57cb73910008b0dbcb
😎 Deploy Preview https://deploy-preview-20818--v11-carbon-react.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link
Contributor

@riddhybansal riddhybansal left a comment

Choose a reason for hiding this comment

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

Consider using useNormalizedInputProps in all components rather than creating separate validation logic:

normalizedProps = useNormalizedInputProps({
id, disabled, readOnly, invalid, invalidText, warn, warnText,
});

Then reference normalizedProps.invalid and normalizedProps.warn for validation states
Our input controls already use this pattern, which makes future fixes simpler (just update the hook once).

Fixed Timepicker components in both React and Web Components to not show
invalid/warn states when in disabled or readonly state, as users cannot
interact with these components in those states.
Fixed Timepicker components in both React and Web Components to not show
invalid/warn states when in disabled or readonly state, as users cannot
interact with these components in those states.
@anuanto966 anuanto966 force-pushed the fix-20727-timepicker branch from 1156df0 to cdf64c8 Compare October 28, 2025 14:12
@anuanto966
Copy link
Contributor Author

Consider using useNormalizedInputProps in all components rather than creating separate validation logic:
@riddhybansal This change is addressed now.

Copy link
Contributor

@riddhybansal riddhybansal left a comment

Choose a reason for hiding this comment

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

Thanks for doing this !! This looks perfect now.

@riddhybansal riddhybansal added this pull request to the merge queue Nov 6, 2025
Merged via the queue into carbon-design-system:main with commit fb1ec8c Nov 6, 2025
41 of 43 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

hacktoberfest See https://hacktoberfest.com/ status: ready to merge 🎉

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[TimePicker]: Disallow invalid & warn when readonly or disabled

3 participants