Opened 7 weeks ago
Last modified 6 weeks ago
#64952 new defect (bug)
Dashboard Quick Draft allows creating an empty draft without title or content
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | 7.1 | Priority: | normal |
| Severity: | normal | Version: | trunk |
| Component: | Administration | Keywords: | has-screenshots has-patch needs-dev-note |
| Focuses: | accessibility, javascript, administration, coding-standards | Cc: |
Description
In the WordPress Dashboard, the Quick Draft widget highlights the title field, but it is still possible to create a draft post without entering a title or any content.
Steps to reproduce:
Go to Dashboard → Quick Draft
Leave both Title and Content empty
Click Save Draft
Current result:
A draft post is created even though no title or content was entered.
Expected result:
WordPress should prevent creating an empty draft or require at least a title before saving from Quick Draft.
Why this matters:
This can create accidental empty draft posts and is confusing from a UX perspective.
Attachments (2)
Change History (11)
#2
@
7 weeks ago
Reproduction Report
Environment
- WordPress: 7.0-RC1-62111-src
- PHP: 8.3.30
- Server: nginx/1.29.6
- Database: mysqli (Server: 8.4.8 / Client: mysqlnd 8.3.30)
- Browser: Chrome 146.0.0.0
- OS: macOS
- Theme: Twenty Thirteen 4.5
- MU Plugins: None activated
- Plugins:
- Query Monitor 3.20.4
- Test Reports 1.2.1
Steps taken
- Go to Dashboard → Quick Draft
- Leave both Title and Content fields empty
- Click on Save Draft
- 🐞 Bug occurs
Expected behavior
- WordPress should prevent saving a draft when both title and content are empty, or
- Require at least a title or content before allowing the draft to be created
This ticket was mentioned in PR #11380 on WordPress/wordpress-develop by @opurockey.
7 weeks ago
#3
- Keywords has-patch added
Ticket: https://core.trac.wordpress.org/ticket/64952
## Summary
This PR fixes an issue in the WordPress dashboard Quick Draft widget where a draft could be submitted even when both the title and content fields were empty.
The update introduces validation to prevent submission unless at least one of these fields contains input, improving data integrity and user experience.
## Problem
Currently, the Quick Draft form allows users to submit completely empty drafts. This results in unnecessary blank draft entries being created in the database, which can clutter the posts list and create confusion.
Similar inconsistencies with Quick Draft behavior have been observed historically, where drafts may be created without meaningful content due to missing validation.
## Solution
- Added validation to the Quick Draft submission flow.
- Prevents form submission when both title and content are empty.
- Ensures at least one field is filled before allowing draft creation.
Changes
- Introduced conditional checks before submitting the Quick Draft form.
- Updated relevant JavaScript/PHP logic to block empty submissions.
## Testing Steps
- Go to WordPress Dashboard → Quick Draft widget.
- Leave both Title and Content empty.
- Attempt to submit.
- Confirm that submission is blocked.
- Add either a title or content and submit again.
- Confirm that the draft is successfully created.
#4
@
7 weeks ago
@sumitsingh From Posts-> Add post, We can't save post if both title and content fields are empty. We can follow the same approach here. I have raised a PR that will prevent submission from quick draft if both fields are empty.
@opurockey commented on PR #11380:
7 weeks ago
#5
@westonruter , Thanks for the suggestions. I’ve addressed the requested improvements and updated the PR accordingly. Please take another look when you have a moment.
@westonruter commented on PR #11380:
7 weeks ago
#6
@OpuRockey An idea came to mind to leverage setCustomValidity so that an error message can be displayed in addition to focusing on the field. I added this in 899ed5b:
https://github.com/user-attachments/assets/306fc4c5-9ef6-4b11-a5dc-bb35d8ffe9cc
This provides the same result as you had, but with added accessibility and improved user experience.
@westonruter commented on PR #11380:
7 weeks ago
#7
- Updated relevant JavaScript/PHP logic to block empty submissions.
It doesn't seem any PHP logic was added to block empty submissions?
#9
@
6 weeks ago
- Keywords needs-dev-note added
@westonruter we've tested alert box in mobile & it looks a bit large as it has same font size that is for desktop & in our opnion font size should be less as compared to desktop by following UX rules.
What's your take on mobile version of alert box font size?
Here are quick recording about empty generating post.