-
Notifications
You must be signed in to change notification settings - Fork 2.1k
fix(DatePicker): prevent invalid/warn states when disabled/readonly #20828
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
base: main
Are you sure you want to change the base?
Conversation
Fixed DatePicker 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.
|
All contributors have signed the DCO. |
✅ Deploy Preview for v11-carbon-web-components ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for carbon-elements ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for v11-carbon-react ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
I have read the DCO document and I hereby sign the DCO. |
|
recheck |
|
I have read the DCO document and I hereby sign the DCO. |
maradwan26
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for contributing! Just some comments on coding conventions and best practices
packages/react/src/components/DatePickerInput/DatePickerInput.tsx
Outdated
Show resolved
Hide resolved
packages/react/src/components/DatePickerInput/DatePickerInput.tsx
Outdated
Show resolved
Hide resolved
|
@Tiss29 You'll need to sign the DCO with both accounts used to pass the DCO check |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #20828 +/- ##
==========================================
- Coverage 92.62% 92.32% -0.30%
==========================================
Files 515 529 +14
Lines 38222 40630 +2408
Branches 5805 5841 +36
==========================================
+ Hits 35403 37513 +2110
- Misses 2670 2968 +298
Partials 149 149
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Fixed DatePicker 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.
|
@maradwan26 I have a doubt regarding the requirement to “sign the DOC with both accounts.” |
|
@Tiss29 The DCO checker says you need to sign it with @Tiss-Joseph because there are commits authored by that account |
|
I have read the DCO document and I hereby sign the DCO. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Fix invalid outline showing with disabled/readonly states in Web Components - Remove duplicate styles from shared _date-picker.scss - Fix failing React tests by moving props to DatePickerInput - Remove unused disabled prop from DatePicker.tsx - Move Web Components tests to correct __tests__ directory - Remove accidental comment from test file
|
@maradwan26 Could please check |
maradwan26
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
packages/web-components/src/components/date-picker/__tests__/date-picker-test.js
Show resolved
Hide resolved
packages/web-components/src/components/date-picker/__tests__/date-picker-test.js
Outdated
Show resolved
Hide resolved
packages/web-components/src/components/date-picker/__tests__/date-picker-test.js
Outdated
Show resolved
Hide resolved
|
@maradwan26 in my web component action I couldn't see invalid |
- Fix test file to use @open-wc/testing fixture pattern - Fix invalid outline showing when disabled or readonly is true - Add invalid/invalidText controls to Storybook stories
|
@maradwan26 Please recheck |
|
Tests are failing for web components. You can run the tests locally by running |
|
@maradwan26 I fix the test |
maradwan26
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM just a couple final suggestions/tweaks!
| :host(#{$prefix}-date-picker-input[disabled]), | ||
| :host(#{$prefix}-date-picker-input[readonly]) { | ||
| .#{$prefix}--form-requirement { | ||
| display: none; | ||
| } | ||
|
|
||
| .#{$prefix}--date-picker__input--invalid, | ||
| .#{$prefix}--date-picker__input--warn { | ||
| border-block-end: 1px solid transparent; | ||
| } | ||
| } | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| :host(#{$prefix}-date-picker-input[disabled]), | |
| :host(#{$prefix}-date-picker-input[readonly]) { | |
| .#{$prefix}--form-requirement { | |
| display: none; | |
| } | |
| .#{$prefix}--date-picker__input--invalid, | |
| .#{$prefix}--date-picker__input--warn { | |
| border-block-end: 1px solid transparent; | |
| } | |
| } |
Same here, this is already accounted for in the component .ts file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
okay I will remove them
| beforeEach(async () => { | ||
| render(defaultTemplate(), document.body); | ||
| await Promise.resolve(); | ||
| datePicker = document.body.querySelector('cds-date-picker'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you should be good to leave this file unchanged.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
okay will revert
packages/web-components/src/components/date-picker/__tests__/date-picker-test.js
Outdated
Show resolved
Hide resolved
….scss Co-authored-by: Mahmoud <[email protected]>
…ate-picker-test.js Co-authored-by: Mahmoud <[email protected]>
|
@maradwan26 @alisonjoseph Please check |





Fixed DatePicker 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 #20722
Fix DatePicker components to not show invalid/warn states when disabled or readonly
Changelog
New
Changed
Testing / Reviewing
PR Checklist
As the author of this PR, before marking ready for review, confirm you:
More details can be found in the pull request guide