Skip to content

Keep post publishing popover open when a date is clicked - #29738

Merged
talldan merged 2 commits into
WordPress:trunkfrom
allilevine:fix/DateTimePicker-date-click-closes-popover
Mar 15, 2021
Merged

talldan merged 2 commits into
WordPress:trunkfrom
allilevine:fix/DateTimePicker-date-click-closes-popover

Conversation

@allilevine

@allilevine allilevine commented Mar 10, 2021 •

Copy link
Copy Markdown
Contributor

Description

Add a keepOpen prop to the DateTimePicker and keep focus on the date picker popover when true.

This isn't an ideal solution, given the note to remove keepFocusInside(), but removing it would require either changes to react-dates or replacing react-dates.

To do: Open a follow-up issue to fix the popover changing position as the date changes (the popover position is relative to the publish date width).

Fixes #24206

How has this been tested?

1. Create a new post
2. Open the schedule popover by clicking on the publish date
3. Click on a date in the picker and confirm that the popover does not close.
4. Navigate to the next month
5. Click on a date and confirm that the popover does not close.
6. Navigate to a date via the keyboard and select it. Confirm that the popover does not close.

Screenshots

Gif of the popover staying open after clicking on a date:
datetimepickerstaysopen

Types of changes

Bug fix: adds a keepOpen prop to DateTimePicker and uses keepFocusInside() to keep the popover open when true.

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • I've tested my changes with keyboard and screen readers.
  • My code has proper inline documentation.
  • I've included developer documentation if appropriate.
  • I've updated all React Native files affected by any refactorings/renamings in this PR.

Add a keepOpen prop to the DateTimePicker and keep focus on the date
picker popover when true.
@github-actions

Copy link
Copy Markdown

👋 Thanks for your first Pull Request and for helping build the future of Gutenberg and WordPress, @allilevine! In case you missed it, we'd love to have you join us in our Slack community, where we hold regularly weekly meetings open to anyone to coordinate with each other.

If you want to learn more about WordPress development in general, check out the Core Handbook full of helpful information.

@github-actions github-actions Bot added the First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository label Mar 10, 2021
@allilevine
allilevine marked this pull request as ready for review March 10, 2021 20:00

@retrofox retrofox left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM. Although it might be fixed straight in the react-dates library, it seems that we aren't going to get a fix. We can re-iterate and update the code later in case the issue is fixed there.
Also, we've been considering replacing the component with other choices.
I'd like to know the opinion of other folks, too.
This PR fixes the issue, which is nice.

@tomjn tomjn left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This looks sensible, I'm giving this a thumbs up 👍🏻

@talldan talldan added [Feature] Saving Related to saving functionality [Type] Bug An existing feature does not function as intended labels Mar 15, 2021
@talldan talldan changed the title DateTimePicker: Keep popover open when date clicked Keep post publishing popover open when a date is clicked Mar 15, 2021
@talldan

talldan commented Mar 15, 2021

Copy link
Copy Markdown
Contributor

Looks good, thanks for working on this, I renamed the PR to make it a bit more user-oriented, as the title ends up in the changelog for the release.

@allilevine

Copy link
Copy Markdown
Contributor Author

I opened a follow-up issue to fix the popover position changing as the date changes: #29899

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Feature] Saving Related to saving functionality First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository [Type] Bug An existing feature does not function as intended

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DateTimePicker: Click on date causes popover to close automatically

5 participants