Skip to content

Plugin Directory: Validate empty search submissions#741

Closed
obenland wants to merge 1 commit into
WordPress:trunkfrom
obenland:fix/plugin-search-required-attribute
Closed

Plugin Directory: Validate empty search submissions#741
obenland wants to merge 1 commit into
WordPress:trunkfrom
obenland:fix/plugin-search-required-attribute

Conversation

@obenland

@obenland obenland commented Jul 27, 2026

Copy link
Copy Markdown
Member

Empty search submissions in the Plugin Directory currently reload the page silently, while the Theme Directory shows the browser's native "Please fill out this field" validation message.

The core search block ships with a required attribute on its input, which the Theme Directory keeps. The Plugin Directory theme strips it in filter_search_block() — deliberately, per r13345, so that submitting an empty form on a search results page can clear the current search.

This PR restores the required attribute everywhere except on search result pages (is_search()), so:

  • Empty submissions from the homepage and archive pages now trigger the native browser validation, matching the Theme Directory.
  • Submitting a cleared field on a search results page still resets the search, preserving the behavior r13345 introduced.

Fixes https://meta.trac.wordpress.org/ticket/8339

🤖 Generated with Claude Code

Empty search submissions currently reload the page silently. Restore the
search block's native required attribute so browsers show their built-in
"Please fill out this field" validation, matching the Theme Directory.

Keep stripping the attribute on search result pages, so an empty
submission can still clear the current search (the reason it was
originally removed in r13345).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 27, 2026 02:06

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions

Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

Core Committers: Use this line as a base for the props when committing in SVN:

Props obenland.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@bazza bazza closed this in 08b412b Jul 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants