Skip to content
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

Keep post publishing popover open when a date is clicked, by default #29893

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions packages/components/src/date-time/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,3 @@ This function will be called on each day, every time user browses into a differe
- Type: `Function`
- Required: No

### keepOpen

Whether focus should stay on the `DateTimePicker` after clicking on a date in the calendar.

- Type: `bool`
- Required: No
8 changes: 3 additions & 5 deletions packages/components/src/date-time/date.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class DatePicker extends Component {
}

onChangeMoment( newDate ) {
const { currentDate, onChange, keepOpen } = this.props;
const { currentDate, onChange } = this.props;

// If currentDate is null, use now as momentTime to designate hours, minutes, seconds.
const momentDate = currentDate ? moment( currentDate ) : moment();
Expand All @@ -71,10 +71,8 @@ class DatePicker extends Component {

onChange( newDate.set( momentTime ).format( TIMEZONELESS_FORMAT ) );

// Keep focus on the date picker popover.
if ( keepOpen ) {
this.keepFocusInside();
}
// Keep focus on the date picker.
this.keepFocusInside();
}

/**
Expand Down
2 changes: 0 additions & 2 deletions packages/components/src/date-time/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ function DateTimePicker(
onMonthPreviewed,
onChange,
events,
keepOpen,
},
ref
) {
Expand All @@ -55,7 +54,6 @@ function DateTimePicker(
isInvalidDate={ isInvalidDate }
onMonthPreviewed={ onMonthPreviewed }
events={ events }
keepOpen={ keepOpen }
/>
</>
) }
Expand Down
1 change: 0 additions & 1 deletion packages/editor/src/components/post-schedule/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ export function PostSchedule( { date, onUpdateDate } ) {
currentDate={ date }
onChange={ onChange }
is12Hour={ is12HourTime }
keepOpen={ true }
/>
);
}
Expand Down