Repository navigation
Conversation
Add a keepOpen prop to the DateTimePicker and keep focus on the date picker popover when true.
|
👋 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. |
retrofox
left a comment
There was a problem hiding this comment.
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
left a comment
There was a problem hiding this comment.
This looks sensible, I'm giving this a thumbs up 👍🏻
|
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. |
|
I opened a follow-up issue to fix the popover position changing as the date changes: #29899 |
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.react-datesissue to keep focus after user changes month: Body gets focus after user changes month with mouse click react-dates/react-dates#1065isFocusedwe can pass to<DayPickerSingleDateController>, but the focus doesn't persist after transitioning to a different month.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?
Screenshots
Gif of the popover staying open after clicking on a date:

Types of changes
Bug fix: adds a
keepOpenprop toDateTimePickerand useskeepFocusInside()to keep the popover open when true.Checklist: