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

Commit

Permalink
Removed disableButtonFocusOnClose prop
Browse files Browse the repository at this point in the history
  • Loading branch information
adavijit committed May 21, 2024
1 parent 554c6b7 commit 3997d80
Show file tree
Hide file tree
Showing 7 changed files with 4 additions and 47 deletions.
10 changes: 2 additions & 8 deletions packages/terra-date-picker/src/DatePicker.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,6 @@ const propTypes = {
* String that labels the current element. 'aria-label' must be present for accessibility.
*/
ariaLabel: PropTypes.string,
/**
* @private
* Whether or not to disable focus on the calendar button when the calendar picker dismisses.
*/
disableButtonFocusOnClose: PropTypes.bool,
/**
* Whether the date input should be disabled.
*/
Expand Down Expand Up @@ -150,7 +145,6 @@ const propTypes = {
};

const defaultProps = {
disableButtonFocusOnClose: false,
disabled: false,
excludeDates: undefined,
filterDate: undefined,
Expand Down Expand Up @@ -266,7 +260,8 @@ class DatePicker extends React.Component {
this.props.onSelect(event, selectedDate.format(DateUtil.ISO_EXTENDED_DATE_FORMAT));
}

if (!this.props.disableButtonFocusOnClose && this.state.showPortalPicker) {
// If the portal picker is displayed, focus on the calendar button on selecting a date
if (this.state.showPortalPicker) {
this.focusCalendarButton();
}
}
Expand Down Expand Up @@ -432,7 +427,6 @@ class DatePicker extends React.Component {
render() {
const {
ariaLabel,
disableButtonFocusOnClose,
excludeDates,
filterDate,
includeDates,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
exports[`should render a calendar filter with default date 1`] = `
<DatePicker
calendarClassName="calendar-filter"
disableButtonFocusOnClose={false}
disabled={false}
errorId=""
intl={
Expand Down Expand Up @@ -49,7 +48,6 @@ exports[`should render a calendar filter with default date 1`] = `
exports[`should render a calendar filter with excluded dates 1`] = `
<DatePicker
calendarClassName="calendar-filter"
disableButtonFocusOnClose={false}
disabled={false}
errorId=""
excludeDates={
Expand Down Expand Up @@ -99,7 +97,6 @@ exports[`should render a calendar filter with excluded dates 1`] = `
exports[`should render a calendar filter with filtered dates 1`] = `
<DatePicker
calendarClassName="calendar-filter"
disableButtonFocusOnClose={false}
disabled={false}
errorId=""
filterDate={[Function]}
Expand Down Expand Up @@ -145,7 +142,6 @@ exports[`should render a calendar filter with filtered dates 1`] = `
exports[`should render a calendar filter with included dates 1`] = `
<DatePicker
calendarClassName="calendar-filter"
disableButtonFocusOnClose={false}
disabled={false}
errorId=""
includeDates={
Expand Down Expand Up @@ -195,7 +191,6 @@ exports[`should render a calendar filter with included dates 1`] = `
exports[`should render a calendar filter with min and max dates 1`] = `
<DatePicker
calendarClassName="calendar-filter"
disableButtonFocusOnClose={false}
disabled={false}
errorId=""
intl={
Expand Down Expand Up @@ -240,7 +235,6 @@ exports[`should render a calendar filter with min and max dates 1`] = `
exports[`should render a calendar filter with onChange 1`] = `
<DatePicker
calendarClassName="calendar-filter"
disableButtonFocusOnClose={false}
disabled={false}
errorId=""
intl={
Expand Down Expand Up @@ -286,7 +280,6 @@ exports[`should render a calendar filter with onChange 1`] = `
exports[`should render a controlled calendar filter 1`] = `
<DatePicker
calendarClassName="calendar-filter"
disableButtonFocusOnClose={false}
disabled={false}
errorId=""
intl={
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ exports[`correctly applies the theme context className 1`] = `
name="date-input"
>
<DatePicker
disableButtonFocusOnClose={false}
disabled={false}
errorId=""
intl={
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,6 @@ exports[`should render a DatePickerField with props 1`] = `
>
<DatePicker
ariaLabel="Label Test"
disableButtonFocusOnClose={false}
disabled={true}
errorId=""
excludeDates={
Expand Down Expand Up @@ -1195,7 +1194,6 @@ exports[`should render a default DatePickerField component 1`] = `
>
<DatePicker
ariaLabel="Label"
disableButtonFocusOnClose={false}
disabled={false}
errorId=""
id="test-date-picker"
Expand Down Expand Up @@ -2174,7 +2172,6 @@ exports[`should render a valid DatePickerField with props 1`] = `
>
<DatePicker
ariaLabel="Label Test"
disableButtonFocusOnClose={false}
disabled={true}
errorId=""
excludeDates={
Expand Down
4 changes: 2 additions & 2 deletions packages/terra-date-time-picker/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

## Unreleased

* Added
* Introduced a new prop `disableButtonFocusOnClose` to optionally disable focusing the button when the calendar is closed.
* Removed
* Removed passing `disableButtonFocusOnClose` prop to the `DatePicker` Component.

## 4.118.1 - (May 20, 2024)

Expand Down
9 changes: 0 additions & 9 deletions packages/terra-date-time-picker/src/DateTimePicker.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,6 @@ const propTypes = {
* ID must be htmlFor prop value with error text.
*/
errorId: PropTypes.string,
/**
* If true, the focus will not return to the button that opened the DatePicker when it is closed.
* This can be useful to prevent unintended focus behavior in certain user flows or accessibility contexts.
* Default is false, meaning focus will return to the button on close.
*/
disableButtonFocusOnClose: PropTypes.bool,
};

const defaultProps = {
Expand All @@ -173,7 +167,6 @@ const defaultProps = {
timeVariant: DateTimeUtils.FORMAT_24_HOUR,
initialTimeZone: DateTimeUtils.getLocalTimeZone(),
errorId: '',
disableButtonFocusOnClose: false,
};

class DateTimePicker extends React.Component {
Expand Down Expand Up @@ -772,7 +765,6 @@ class DateTimePicker extends React.Component {
value,
timeVariant,
errorId,
disableButtonFocusOnClose,
...customProps
} = this.props;

Expand Down Expand Up @@ -819,7 +811,6 @@ class DateTimePicker extends React.Component {
value={dateValue}
name="input"
disabled={disabled}
disableButtonFocusOnClose={disableButtonFocusOnClose}
isIncomplete={isIncomplete}
isInvalid={isInvalid}
required={required}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ exports[`correctly applies the theme context className 1`] = `
exports[`renders DateTimePicker with correct ARIA attributes 1`] = `
<DateTimePicker
ariaLabel="Enter Date/Time"
disableButtonFocusOnClose={false}
disabled={false}
errorId=""
initialTimeZone="America/Chicago"
Expand Down Expand Up @@ -66,7 +65,6 @@ exports[`renders DateTimePicker with correct ARIA attributes 1`] = `

exports[`should render a date time picker with a default date and time 1`] = `
<DateTimePicker
disableButtonFocusOnClose={false}
disabled={false}
errorId=""
initialTimeZone="America/Chicago"
Expand Down Expand Up @@ -112,7 +110,6 @@ exports[`should render a date time picker with a default date and time 1`] = `

exports[`should render a date time picker with disabled dates 1`] = `
<DateTimePicker
disableButtonFocusOnClose={false}
disabled={false}
errorId=""
excludeDates={
Expand Down Expand Up @@ -162,7 +159,6 @@ exports[`should render a date time picker with disabled dates 1`] = `

exports[`should render a date time picker with filtered dates 1`] = `
<DateTimePicker
disableButtonFocusOnClose={false}
disabled={false}
errorId=""
filterDate={[Function]}
Expand Down Expand Up @@ -208,7 +204,6 @@ exports[`should render a date time picker with filtered dates 1`] = `

exports[`should render a date time picker with included dates 1`] = `
<DateTimePicker
disableButtonFocusOnClose={false}
disabled={false}
errorId=""
includeDates={
Expand Down Expand Up @@ -258,7 +253,6 @@ exports[`should render a date time picker with included dates 1`] = `

exports[`should render a date time picker with min and max dates 1`] = `
<DateTimePicker
disableButtonFocusOnClose={false}
disabled={false}
errorId=""
initialTimeZone="America/Chicago"
Expand Down Expand Up @@ -303,7 +297,6 @@ exports[`should render a date time picker with min and max dates 1`] = `

exports[`should render a date time picker with onBlur 1`] = `
<DateTimePicker
disableButtonFocusOnClose={false}
disabled={false}
errorId=""
initialTimeZone="America/Chicago"
Expand Down Expand Up @@ -349,7 +342,6 @@ exports[`should render a date time picker with onBlur 1`] = `

exports[`should render a date time picker with onChange 1`] = `
<DateTimePicker
disableButtonFocusOnClose={false}
disabled={false}
errorId=""
initialTimeZone="America/Chicago"
Expand Down Expand Up @@ -395,7 +387,6 @@ exports[`should render a date time picker with onChange 1`] = `

exports[`should render a date time picker with onChangeRaw 1`] = `
<DateTimePicker
disableButtonFocusOnClose={false}
disabled={false}
errorId=""
initialTimeZone="America/Chicago"
Expand Down Expand Up @@ -441,7 +432,6 @@ exports[`should render a date time picker with onChangeRaw 1`] = `

exports[`should render a date time picker with the seconds field enabled 1`] = `
<DateTimePicker
disableButtonFocusOnClose={false}
disabled={false}
errorId=""
initialTimeZone="America/Chicago"
Expand Down Expand Up @@ -486,7 +476,6 @@ exports[`should render a date time picker with the seconds field enabled 1`] = `

exports[`should render a default date time picker 1`] = `
<DateTimePicker
disableButtonFocusOnClose={false}
disabled={false}
errorId=""
initialTimeZone="America/Chicago"
Expand Down Expand Up @@ -532,7 +521,6 @@ exports[`should render a default date time picker 1`] = `
exports[`should render a default date time picker with ariaLabel 1`] = `
<DateTimePicker
ariaLabel="Select date and time"
disableButtonFocusOnClose={false}
disabled={false}
errorId=""
initialTimeZone="America/Chicago"
Expand Down Expand Up @@ -582,7 +570,6 @@ exports[`should render a default date time picker with custom date input attribu
"id": "terra-date-input",
}
}
disableButtonFocusOnClose={false}
disabled={false}
errorId=""
initialTimeZone="America/Chicago"
Expand Down Expand Up @@ -627,7 +614,6 @@ exports[`should render a default date time picker with custom date input attribu

exports[`should render a default date time picker with custom time input attributes 1`] = `
<DateTimePicker
disableButtonFocusOnClose={false}
disabled={false}
errorId=""
initialTimeZone="America/Chicago"
Expand Down Expand Up @@ -677,7 +663,6 @@ exports[`should render a default date time picker with custom time input attribu

exports[`should render a disabled date time picker 1`] = `
<DateTimePicker
disableButtonFocusOnClose={false}
disabled={true}
errorId=""
initialTimeZone="America/Chicago"
Expand Down Expand Up @@ -722,7 +707,6 @@ exports[`should render a disabled date time picker 1`] = `

exports[`should render a error message 1`] = `
<DateTimePicker
disableButtonFocusOnClose={false}
disabled={false}
errorId="default-invalid-error"
initialTimeZone="America/Chicago"
Expand Down Expand Up @@ -767,7 +751,6 @@ exports[`should render a error message 1`] = `

exports[`should render with a default timeVariant if variant is not specified 1`] = `
<DateTimePicker
disableButtonFocusOnClose={false}
disabled={false}
errorId=""
initialTimeZone="America/Chicago"
Expand Down

0 comments on commit 3997d80

Please sign in to comment.