Skip to content

Tracking: Improve blocks that have placeholder form #41961

@t-hamano

Description

@t-hamano

Overview

Some blocks have form elements within Placeholder component.
In this tracking issue, I would like to discuss applying a uniform style to these blocks and solving some problems.
I would like to hear your opinions.

Target blocks

  • core/embed
  • core/rss
  • core/table
  • core/shortcode

What's the problem?

As may be related to this comment, I think the following problems exist with blocks that have form elements within Placeholder component.

  • Input elements and submit buttons are styled separately in each block.
  • Layout is broken in the site editor or on certain screen widths.

Solution

I propose the following 3 solutions to these problems.

1. Don't use the element directly

In the core/embed block, the input[type="url"] element is used, but it should be replaced with TextControl as in the core/rss block.

<input
type="url"
value={ value || '' }
className="components-placeholder__input"
aria-label={ label }
placeholder={ __( 'Enter URL to embed here…' ) }
onChange={ onChange }
/>

2. Use gap style in form tags

In core/table, core/rss, core/embed block, input elements and button are placed directly under form tag, but the styling of these elements varies from block to block.

e.g.

.blocks-table__placeholder-form.blocks-table__placeholder-form {
display: flex;
flex-direction: column;
align-items: flex-start;
> * {
margin-bottom: $grid-unit-10;
}

Applying gap: 8px; to the form tag eliminates the need for the block's own styling and ensures that the margins are correctly maintained at any screen width.

3. Apply box-sizing to form elements

The site editor doesn't apply box-sizing:border-box to form elements, so the layout is broken in several blocks.
To fix this, I think we should apply box-sizing:border-box to the input element directly below the form tag.

Problems per block

The following are problems per block I have found:

core/embed

core/rss

core/table

core/shortcode

Metadata

Metadata

Assignees

Labels

[Block] EmbedAffects the Embed Block[Block] RSSAffects the RSS Block - used to display entries from an RSS/Atom feed[Block] ShortcodeAffects the Shortcode Block[Block] TableAffects the Table Block[Package] Components/packages/components[Status] In ProgressTracking issues with work in progress[Type] EnhancementA suggestion for improvement.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions