gillish

Open a window over the page

The Modal block A piece of a page, such as a paragraph, a picture or a button. In WordPress you build a page by putting blocks one after another. is a window over the page that holds any blocks. A button opens it, or it opens by itself. See it working on the Modal page.

Add a modal

  1. Add the Modal block where you want it. It adds two linked blocks: a Button that opens it, and the panel.

  2. Add the blocks the window should hold inside the panel, such as a heading and a paragraph.

  3. Click the panel to see its settings in the Settings tab.

The Button has the settings of any Button (see Add a button that links or acts).

A Modal that opens from a Join the newsletter button and holds a sign-up form, in the editor, and the Modal panel in the Settings tab with Name for screen readers, How it is sized and Width.
A window with a sign-up form, with its name and size.

Name and size

  • Name for screen readers: leave it empty to use the first heading inside the panel, or Dialog if there is none.
  • How it is sized: Set the width, height follows (the one to pick if you are unsure), Exact size (the default), Full screen, or Fits the content.
  • Width (px) and Height (px): 600 and 400 to start. On a screen narrower than this, the panel uses the screen instead.
  • Where it opens: Middle of the screen (the default), Near the top or Near the bottom.
  • On a small screen: Rearrange (the default); Shrink, keep text readable; or Shrink all the way.
  • Let content hang outside the panel (off to start). Off, anything past an edge is cut off, and the panel scrolls if its content is tall. Turn it on to let a tab or a badge sit outside the edge.

Opening and closing

  • A button opens it is on to start. Turn it off to open the modal only by itself, and the button is removed.
  • Close on click outside is on to start. The modal also closes on the Escape key. Add your own close button inside the panel if you want one.
  • Modal ID: set for you. To open this modal from another button, paste this id into Opens which modal? on that button.

Colours and shape

Where you set the look depends on where you edit the block. In a normal post or page, the Styles tab has WordPress’s own controls: colour, typography, padding and margin, and border. In a saved Cairnstone block, under Cairnstone → Blocks, the Styles tab has Cairnstone’s full set: colour (a ready-made set or your own), typography, border, shadow, filters, and size and spacing, each for the normal state and for hover, focus, pressed and switched off.

The same Modal, and the Styles tab of a saved Cairnstone block with Color open.
The window’s colours, in the Styles tab.

What visitors get

A real browser dialog, named by its heading for screen readers A program that reads the screen aloud, for people who cannot see it well. They move around the page with the keyboard and hear what is there..

Next, read List your posts in a grid.

Trails

Cairnstone