Opened 4 weeks ago
Closed 11 days ago
#65647 closed defect (bug) (fixed)
On This Day: The behavior is strange when there is nothing to display
| Reported by: | wildworks | Owned by: | joedolson |
|---|---|---|---|
| Priority: | normal | Milestone: | 7.1 |
| Component: | Widgets | Version: | trunk |
| Severity: | normal | Keywords: | has-patch has-unit-tests |
| Cc: | Focuses: |
Description
Related to #65116
Props to @welcher; I discovered this problem while watching his livestream.
The On This Day widget is visually hidden using the hidden class when there is nothing to display.
However, this causes confusion because the "On This Day" option is checked in the Screen Options, making it unclear why the widget isn't visible. Furthermore, if you uncheck and then recheck the option, the widget becomes visually apparent as the JavaScript injects the display: block style.
Testing Instructions
- Access the dashboard and confirm that the "On This Day" widget is not displayed.
- Open Screen Options and verify that "On This Day" is checked.
- Uncheck it once, then check it again.
- The "On This Day" widget will then be visually displayed.
Proposed solutions
Here are two solutions that come to mind.
- Display the widget even when there is no content to show. In other words, stop injecting the
hiddenclass. - Use a CSS class with
!importantinstead ofhiddento always overwrite the JavaScript injection ofdisplay:block.
Attachments (4)
Change History (34)
This ticket was mentioned in PR #12575 on WordPress/wordpress-develop by @iamchitti.
4 weeks ago
#2
- Keywords has-patch has-unit-tests added
## Trac ticket
https://core.trac.wordpress.org/ticket/65647
## Problem
The On This Day dashboard widget is hidden with the core hidden class when there are no posts to show for the current calendar day. This creates inconsistent, confusing behavior:
- The widget is not visible on the dashboard, but its Screen Options checkbox is still checked — so the reported state disagrees with what's actually shown.
- Unchecking and re-checking the option reveals the widget, because
postbox.jscalls jQuery's.show(), which injects an inlinedisplay: blockthat overrides the.hiddenclass.
The root cause is two independent hide mechanisms competing: a server-side hidden class vs. the persisted per-user Screen Options preference.
## Fix
Take the "always show" approach (option 1 from the ticket):
- Remove the
postbox_classes_dashboard_wp_dashboard_on_this_dayfilter and thewp_dashboard_on_this_day_postbox_classes()function that added thehiddenclass. - The widget is now always registered and always visible. When there are no matching posts, the existing placeholder — _"No posts were published on this day in previous years."_ — is shown.
- Hiding is deferred entirely to Screen Options, which persists correctly and keeps the checkbox state consistent with on-screen visibility.
This is consistent with other always-registered dashboard widgets (e.g. _Activity_, _At a Glance_) and avoids !important CSS hacks.
## Testing instructions
- Ensure there are no published posts dated on today's month/day in a previous year (a recent install satisfies this by default).
- Visit the Dashboard.
- Before this change: the widget is not visible, yet "On This Day" is checked in Screen Options; unchecking and re-checking reveals it.
- After this change: the widget is always visible and shows the placeholder message; the Screen Options checkbox state matches its visibility. Unchecking hides it and the preference persists across reloads.
## Screenshots
Before
After
## Use of AI Tools
AI assistance: Yes
Tool(s): Claude Code
Model(s): Opus 4.8
Used for: update unit tests
#3
@
4 weeks ago
While always showing the widget is cleaner, and a clearer user interaction, hiding it when there's no information was a specific comment from @matt; we should get some clarity on whether this is a viable approach.
This ticket was mentioned in Slack in #core-test by huzaifaalmesbah. View the logs.
3 weeks ago
#5
@
3 weeks ago
Patch Test Report
Description
Tested #65647 to verify that the "On This Day" dashboard widget always renders with the empty placeholder message when there are no past posts on the current date, resolving the visibility mismatch with Screen Options.
Environment
- WordPress: 7.1-beta3
- Subdirectory: No
- PHP: 8.2.29
- Server: nginx/1.26.1
- Database: mysqli (Server: 8.0.35 / Client: mysqlnd 8.2.29)
- Browser: Chrome 150.0.0.0
- OS: Windows 10/11
- Theme: Twenty Twenty-Five 1.5
- MU Plugins: None activated
- Plugins:
- Test Reports 1.3.0
- WordPress Beta Tester 4.0.0
Steps to Test
- Ensure there are no published posts on the site dated today's month/day from previous years.
- Navigate to the Admin Dashboard.
- Confirm that the "On This Day" widget is visible by default, showing *"No posts were published on this day in previous years."*
- Open Screen Options and verify that the "On This Day" checkbox is checked (matching visual visibility).
- Uncheck "On This Day" in Screen Options; verify the widget hides cleanly.
- Re-check "On This Day" in Screen Options; verify the widget appears correctly.
- Refresh the page to confirm that the preference persists across page reloads.
Expected Results
- The widget and Screen Options checkbox state are always in sync.
- When there are no matching posts, the widget remains visible displaying the informative placeholder message.
- Hiding/showing via Screen Options works seamlessly without CSS or inline style conflicts.
Actual Results
- Patch works as expected. The "On This Day" widget is displayed continuously with the placeholder message, and toggling via Screen Options behaves predictably without unexpected behavior.
Additional Notes
- Patch tested
Supplemental Artifacts
Added as Attachment
#7
@
3 weeks ago
Test Report
Description
The On This Day widget is visually hidden using the hidden class when there is nothing to display.
However, this causes confusion because the "On This Day" option is checked in the Screen Options, making it unclear why the widget isn't visible. Furthermore, if you uncheck and then recheck the option, the widget becomes visually apparent as the JavaScript injects the display: block style.
Patch tested: https://github.com/WordPress/wordpress-develop/pull/12575/changes
Environment
- WordPress: 7.0.3-alpha-62793
- Subdirectory: No
- PHP: 8.4.14
- Server: nginx/1.21.4
- Database: mysqli (Server: 5.7.44-log / Client: mysqlnd 8.4.14)
- Browser: Chrome 150.0.0.0
- OS: macOS
- Theme: Twenty Twenty-Five 1.5
- MU Plugins: None activated
- Plugins:
- Test Reports 1.3.0
- WordPress Beta Tester 4.0.0
- WP File Manager 8.0.4
Steps to Reproduce
Ensure there are no published posts on the site dated today's month/day from previous years.
Navigate to the Admin Dashboard.
Confirm that the "On This Day" widget is visible by default, showing *"No posts were published on this day in previous years."*
Open Screen Options and verify that the "On This Day" checkbox is checked (matching visual visibility).
Uncheck "On This Day" in Screen Options; verify the widget hides cleanly.
Re-check "On This Day" in Screen Options; verify the widget appears correctly.
Refresh the page to confirm that the preference persists across page reloads.
Expected Results
The widget and Screen Options checkbox state are always in sync.
When there are no matching posts, the widget remains visible, displaying the informative placeholder message.
Hiding/showing via Screen Options works seamlessly without CSS or inline style conflicts.
Actual Results
- Patch Works ✅
#8
@
3 weeks ago
Test Report
This Report Validates that the indicated patch address the issue.✅
Patch Tested: https://github.com/WordPress/wordpress-develop/pull/12575
Environment:
WordPress - 7.1-beta1-20260717.050507
OS - Windows
Browser - Chrome
Theme: Twenty Twenty Five
PHP - 7.4.33
Plugin - None
Actual Results:
- Issue Resolved with Patch ✅
Supplemental Artifacts
- Attached
#9
@
3 weeks ago
While always showing the widget is cleaner, and a clearer user interaction, hiding it when there's no information was a specific comment from @matt; we should get some clarity on whether this is a viable approach.
Please note that we need to clarify and agree on this point before testing and proceeding with the attached patch.
#10
@
3 weeks ago
Test Report
Patch tested: https://patch-diff.githubusercontent.com/raw/WordPress/wordpress-develop/pull/12575.diff
Environment
- WordPress: 7.1-beta1-20260717.050507
- Subdirectory: No
- PHP: 7.4.33
- Server: PHP.wasm
- Database: WP_SQLite_Driver (Server: 8.0.38 / Client: 3.51.0)
- Browser: Chrome 150.0.0.0
- OS: macOS
- Theme: Twenty Twenty-Five 1.5
- MU Plugins: None activated
- Plugins:
- Test Reports 1.3.0
Steps taken
- Reproduced the bug on 7.1-beta1-20260717.050507
- Tested the Patch on Playground
✅ Verified that the patch is solving the problem
#12
@
3 weeks ago
Test Report
Patch tested: https://patch-diff.githubusercontent.com/raw/WordPress/wordpress-develop/pull/12575.diff
Environment
- WordPress: 7.1-alpha-20260717
- Subdirectory: No
- PHP: 8.4
- Server: PHP.wasm
- Database: WP_SQLite_Driver (Server: 8.0.38 / Client: 3.51.0)
- Browser: Chrome 150.0.0.0
- OS: macOS 26
- Theme: Twenty Twenty-Five 1.5
- MU Plugins: None activated
- Plugins:
- Test Reports 1.3.0
Steps taken
- Accessed the WordPress dashboard where the "On This Day" widget had no content to display and verified it was hidden while remaining checked under Screen Options.
- Applied and tested the patch from patch using the WordPress Playground preview environment.
- Re-evaluated the "On This Day" widget container behavior to ensure proper visibility logic and prevent JS injection UI conflicts.
- ✅ Patch is solving the problem
Expected result
- The "On This Day" dashboard widget and Screen Options checkbox behavior should remain properly aligned, preventing UI confusion and unwanted visibility toggles when no content is present.
Additional Notes
- Successfully tested and verified patch. The patch correctly resolves the bug where unchecking and rechecking Screen Options forced an empty widget to display due to JavaScript style injection conflicts.
Screenshots/Screencast with results
- N/A
Support Content
@wildworks commented on PR #12575:
2 weeks ago
#13
I have made two changes to this PR. It is ready for re-review.
- dc0aea507b89b3aeafdf04e21aeb5f6504c84ad3: Resolve conflicts.
- d218c56c885149a07deb1d1782dfa5c3d71db745: Remove the wp_dashboard_on_this_day_setup function. This is because it is now merely a wrapper for wp_add_dashboard_widget and is deemed to have no further purpose.
@wildworks commented on PR #12575:
2 weeks ago
#14
I've been thinking about this, and I'm leaning towards supporting this PR that always displays the On This Day widget.
@m suggested hiding the On This Day widget entirely when there's no content to display. However, implementing this presents some tricky challenges. A significant issue is that the widget might be visually absent, yet its checkbox in the Screen Options would still appear.
While we can hide the "On This Day" checkbox within Screen Options, it requires a somewhat convoluted approach.
Furthermore, the current behavior might be perceived as a bug. Please refer to this livestream by Ryan. https://www.twitch.tv/videos/2821389287?t=42m35s
@annezazu @joedolson, I plan to move forward with this PR, what are your thoughts?
@annezazu commented on PR #12575:
2 weeks ago
#15
Thanks for surfacing this. I agree in having it always on, both to avoid technical concerns and to prevent confusion around the checkbox problem. I can see how that would be confusing. Since this means the empty state will be more readily visible, perhaps we can spruce it up from this:
For example, here's what site health shows:
Maybe something like this, where we link to "Add post"?
@WordPress/gutenberg-design for any empty state thoughts here :)
@joedolson commented on PR #12575:
2 weeks ago
#16
I agree with this. Ultimately, hiding it creates a lot of technical problems that are largely unnecessary, and creates a user experience that's potentially confusing.
I feel like the text should be more invitational; something like "You haven't published a post on this day before. Write one now, and be reminded about it next year!"
But I think getting some copy work on this would be good; and we need to nail that down by RC, for translators sakes.
@annezazu commented on PR #12575:
2 weeks ago
#17
I like your text more than mine (and don’t feel strongly). Another option: “No posts were published on this day in previous years. Write one today, and be reminded about it next year.”
@iamchitti commented on PR #12575:
2 weeks ago
#18
I like the prompt by @joedolson - "Write one today, and be reminded about it next year". But ideally, if published on the day, it will be shown next year on same date. So, I guess it should be "Publish one today, and be reminded about it next year".
Let me know once copy is finalized. I will do the final copy update quickly.
@paaljoachim commented on PR #12575:
2 weeks ago
#19
I see the dashboard as an area that is meant to focus on the customers site to where they can gain useful information. On keeping On This Day dashboard widget....not sure I see the use in that...sorry. I do see it kind of like a history widget though. Like a curiosity...
@Joen commented on PR #12575:
2 weeks ago
#20
Things moving fast here, good work all around. I'll try and respond primarily to the ping on the empty-state.
Which is to say, in the current context and widget implementation, it largely works to prompt and explain. It's a pity we can't hide it when it's empty: I endorse moving forward without that feature in the name of iteration, but nevertheless I want to acknowledge the instinct: when it's populated it's a moment of delight. When it's empty, it's a question: why is this here? Not blocking, but encouraging future iteration in this space.
And it's extra context for tweaking the help text, because for me it suggests that the text should be as minimal as possible, so that it serves as the lightest write-prompt+explanation we can muster, but otherwise reduce its footprint so it doesn't annoy. In that sense, we could go one of these directions:
- Nothing here yet. [Write today's post].
- No posts on this day yet. [Start one now] for next year.
- This day is empty. [Write something] worth revisiting.
I can understand an argument to want to stay verbose afterall: on a big screen two lines of text might not feel like a lot. But the problem is: on many blogs, and certainly many static sites that aren't used as blogs, you'll see this text a lot, which is why I'm leaning towards less text. (Also a question: can we/is the widget already hidden if a site has no posts at all?)
Nevertheless if you want the more verbose text, you could go in one of these directions:
- Anne's option: No posts were published on this day in previous years. [Write one today], and be reminded about it next year.
- Today's archive is empty for now. [Write something today] to start filling it in.
- Nothing was written on this day before. [Start today] to change that.
@wildworks commented on PR #12575:
2 weeks ago
#21
I tried the suggested text. I would love to hear your feedback.
No posts were published on this day in previous years. (Current text)
Nothing here yet. [Write today's post].
No posts on this day yet. [Start one now] for next year.
This day is empty. [Write something] worth revisiting.
No posts were published on this day in previous years. [Write one today], and be reminded about it next year.
Today's archive is empty for now. [Write something today] to start filling it in.
Nothing was written on this day before. [Start today] to change that.
@joedolson commented on PR #12575:
2 weeks ago
#22
Many widgets are only useful to some users - the majority of users will never attend a WordPress event and are unconcerned with WordPress news. I don't think we need to concern ourselves too much with whether or not all users will benefit from it. Users who use the dashboard at all will customize it to their needs - other users won't use it, and it will make little difference to them what's there.
I don't particularly like using 'empty'; it doesn't feel very friendly to me. I'm also not thrilled with "Write something worth revisiting", as it puts unnecessary pressure by setting a value judgement on publishing.
My preference from above would be "Nothing here yet. [Write today's post]." Short and to the point.
@wildworks commented on PR #12575:
2 weeks ago
#23
My preference from above would be "Nothing here yet. [Write today's post]." Short and to the point.
I tried this.
@annezazu commented on PR #12575:
2 weeks ago
#24
I don't think that really connects what the widget does though and we need to assume folks need that connection. I'd prefer we go with this:
No posts were published on this day in previous years. [Write one today], and be reminded about it next year.
I think it matches a friendliness in our interface that we shouldn't be afraid to have (think "hello dolly" vibes), especially when looking at the approach for the events widget that asks people to consider organizing an event.
@wildworks commented on PR #12575:
13 days ago
#25
No posts were published on this day in previous years. [Write one today], and be reminded about it next year.
I have changed the wording. I don't have a strong opinion on the phrasing, but in any case, it might be best to commit this PR towards RC1 and gather user feedback.
@mukesh27 commented on PR #12575:
13 days ago
#26
It might be best to commit this PR towards RC1 and gather user feedback.
Go for it @t-hamano
#27
@
12 days ago
- Keywords commit added
I'm agreeing with @wildworks that it would be best to commit this and gather feedback. There's certainly nothing wrong with the friendly text; it has a good vibe - and we could discuss possible phrasing indefinitely without coming to a clear "best possible phrase".
Marking for commit.
#28
@
12 days ago
- Keywords commit removed
In principle this is commit ready, but the tests need to be reworked a bit, so I'm going to move it out of commit for now.
@wildworks commented on PR #12575:
12 days ago
#29
The unit test failures should be resolved now.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Digging into this, the root cause is that two independent hide mechanisms are fighting each other:
hiddenclass (display: none) added bywp_dashboard_on_this_day_postbox_classes()when there are no posts to show.So the checkbox reports "shown" while the widget is actually hidden by our class. And when you uncheck/recheck,
postbox.jscalls jQuery's.show(), which injects an inlinedisplay: blockthat overrides.hidden— revealing the widget. Hence the inconsistent behavior.Weighing the two proposed solutions:
hiddenclass)!importantinstead ofhidden!importantbeats the inlinedisplay: blockthat jQuery injects on recheck.!important, which core CSS generally avoids; it papers over the JS/CSS conflict rather than resolving it.Given the above, approach 1 is the cleaner fix: it removes the mismatch entirely, respects the user's Screen Options control, and avoids
!important. The only cost — a placeholder on quiet days — is consistent with other always-registered dashboard widgets.I'll raise a PR implementing approach 1 (removing the
postbox_classesfilter so the widget always renders.