Skip to content
Sign in
Search Modal Block icon

Search Modal Block

A block that shows a search icon and opens the site search form in a modal dialog when clicked.

Not scanned yet WordPress plugin 70 installs

Install in

No install steps yet

Follow the steps on the source page.

Search Modal Block adds one block, Search Modal Block, to the inserter. On the page it renders a button with a search icon. Clicking the button opens a modal with a standard WordPress search form that submits to your site’s search results.

In the block inspector you can set:

  • The placeholder text in the search field.
  • The text on the submit button.
  • The label text, which is read by screen readers and can also be shown above the field.
  • The button icon: the default magnifying glass, or an image from the media library.
  • The icon size: S, M, L, XL, or a custom value in px, em, rem, or %.

The modal is a role="dialog" with aria-modal, a title for assistive technology, and a close button. Opening it moves focus into the dialog and locks page scrolling; Escape and the overlay close it. The form uses the theme’s wp-block-search and wp-block-button__link classes, so it picks up the same styling as the core Search and Buttons blocks.

The front-end script (MicroModal plus the init call, about 3 KB gzipped) loads only on pages that contain the block. The stylesheet is page-scoped on block themes; classic themes load every registered block’s styles on every page.

Credits

The modal is driven by MicroModal, a small modal library released under the ISC license.

Written by Joobi from the project's own listing. See the source page

blockmodalpopup searchsearchsearch form
25 Nov 2026
Version 1.3.2 released. Not scanned yet.

1.3.2

  • Tested up to WordPress 7.2.
  • Rewrote the plugin description and FAQ in plain English.

1.3.1

  • Tested up to WordPress 7.1.

1.3.0

  • Changed the search field to type="search" for the native clear control.
  • Added block deprecations so blocks added with earlier versions keep working after an update.
  • Updated MicroModal to 0.7.0.
  • Tested up to WordPress 7.0.

1.2.0

  • Tested up to WordPress 6.9.
  • Fixed the form action URL on subdirectory and multisite installations.
  • Added a modal title and ARIA labels for the dialog and close button.

1.1.0

  • Added a custom icon option that takes an image from the media library.
  • Added icon size controls with S, M, L, and XL presets and a custom size.

1.0.1

  • Added the WordPress.org assets and the src directory to the release.

1.0.0

  • Initial release.
  • Added placeholder, button text, and label text settings.
  • Added focus-visible styles for keyboard users.
23 Nov 2024Listed on Joobi from WordPress.org.

Follow this listing's changes (Atom feed)