Skip to content
This repository has been archived by the owner on May 24, 2024. It is now read-only.

[date-time-picker] Defect fixes #2036

Merged
merged 13 commits into from
Feb 21, 2024
Merged

[date-time-picker] Defect fixes #2036

merged 13 commits into from
Feb 21, 2024

Conversation

ashishkumbhare116
Copy link
Contributor

@ashishkumbhare116 ashishkumbhare116 commented Feb 16, 2024

Summary

Invalid field SR announcement fix & Calendar von value change SR announcement fix .
Doc/Example update for TimeZone SR announcement.

What was changed:

Why it was changed:

Testing

This change was tested using:

  • WDIO
  • Jest
  • Visual testing (please attach a screenshot or recording)
  • Other (please describe below)
  • No tests are needed

Reviews

In addition to engineering reviews, this PR needs:

  • UX review
  • Accessibility review
  • Functional review

Additional Details

This PR resolves:

UXPLATFORM-10236
UXPLATFORM-10237


Thank you for contributing to Terra.
@cerner/terra

@ashishkumbhare116 ashishkumbhare116 marked this pull request as ready for review February 16, 2024 14:10
@ashishkumbhare116 ashishkumbhare116 changed the title DateTimePicker defect fixes [date-time-picker] Defect fixes Feb 18, 2024
/>
</Field>
<Fieldset
type="checkbox"
Copy link
Contributor

Choose a reason for hiding this comment

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

why is type attribute used here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not needed .Changed 08f942a

@@ -801,8 +801,9 @@ class DatePicker extends React.Component {
isCalendarOpenedViaKeyboard={this.state.isCalendarOpenedViaKeyboard}
initialTimeZone={this.props.initialTimeZone}
>
<VisuallyHiddenText aria-atomic="true" aria-live="assertive" refCallback={(ref) => { this.visuallyHiddenText = ref; }} className={cx('react-datepicker-visuallyhiddentext')}>
Copy link
Contributor

Choose a reason for hiding this comment

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

This change is not valid since it prevents SR from announcing the dates when navigated with arrow keys.

Copy link
Contributor Author

@ashishkumbhare116 ashishkumbhare116 Feb 20, 2024

Choose a reason for hiding this comment

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

Yes Right Have 50a6cc2 implemented changes.

const isValidDateSelection = date ? isDayInRange(date, this.props.minDate, this.props.maxDate) : true
if (isValidDateSelection) {
this.setState({
preSelection: date
})
type === "month" ? this.updateAriaLiveStatus(getMonthFromDate(date, this.props)) :
Copy link
Contributor

Choose a reason for hiding this comment

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

is there any existing getmonth utility that can be used ?
what is this returning? https://github.com/cerner/terra-framework/blob/main/packages/terra-date-picker/src/react-datepicker/date_utils.js#L121

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No this one is returning the numeric value for month .

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For the month string value required to create new utility function

const isValidDateSelection = date ? isDayInRange(date, this.props.minDate, this.props.maxDate) : true
if (isValidDateSelection) {
this.setState({
preSelection: date
})
type === "month" ? this.updateAriaLiveStatus(getMonthFromDate(date, this.props)) :
type === "year" ? this.updateAriaLiveStatus(value, this.props) :
Copy link
Contributor

Choose a reason for hiding this comment

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

use constants for month and year here and other places where method is called (if doesnt exist)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

46534ab Added

const isValidDateSelection = date ? isDayInRange(date, this.props.minDate, this.props.maxDate) : true
if (isValidDateSelection) {
this.setState({
preSelection: date
})
type === "month" ? this.updateAriaLiveStatus(getMonthFromDate(date, this.props)) :
type === "year" ? this.updateAriaLiveStatus(value, this.props) :
Copy link
Contributor

Choose a reason for hiding this comment

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

updateAriaLiveStatus accepts only one arg.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This one added 5 years back and followed the same flow, second prop is internally using the date_util's intl prop value without using it is throwing an error as “cannot read property of intl "

const isValidDateSelection = date ? isDayInRange(date, this.props.minDate, this.props.maxDate) : true
if (isValidDateSelection) {
this.setState({
preSelection: date
})
type === "month" ? this.updateAriaLiveStatus(getMonthFromDate(date, this.props)) :
type === "year" ? this.updateAriaLiveStatus(value, this.props) :
this.updateAriaLiveStatus(getLocalizedDateForScreenReader(date, this.props));
Copy link
Contributor

Choose a reason for hiding this comment

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

how is this not overwriting the previous lines (even though SR announces only month/year when changed). Can this line be re-checked once

Copy link
Contributor Author

@ashishkumbhare116 ashishkumbhare116 Feb 21, 2024

Choose a reason for hiding this comment

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

No it is not overwriting the previous lines have cross checked as this is similar to this in if & else condition if (type === 'month') {
this.updateAriaLiveStatus(getMonthFromDate(date, this.props));
} else if (type === 'year') {
this.updateAriaLiveStatus(value, this.props);
} else {
this.updateAriaLiveStatus(getLocalizedDateForScreenReader(date, this.props));

}

const isValidDateSelection = date ? isDayInRange(date, this.props.minDate, this.props.maxDate) : true
if (isValidDateSelection) {
this.setState({
preSelection: date
})
type === "month" ? this.updateAriaLiveStatus(getMonthFromDate(date, this.props)) :
type === "year" ? this.updateAriaLiveStatus(value, this.props) :
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
type === "year" ? this.updateAriaLiveStatus(value, this.props) :
type === "year" ? this.updateAriaLiveStatus(value) :

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes ,sorry missed it 81d4628

@github-actions github-actions bot temporarily deployed to preview-pr-2036 February 21, 2024 09:56 Destroyed
@rahulkumar8cs
Copy link

+1 for the latest a11y changes,
Visual form label issue we need to fix in upcoming jira.

@saket2403 saket2403 merged commit 1d4b562 into main Feb 21, 2024
22 checks passed
@saket2403 saket2403 deleted the dateTimePickerIssues branch February 21, 2024 12:10
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants