Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tracking: Improve blocks that have placeholder form #41961

Closed
10 of 12 tasks
t-hamano opened this issue Jun 26, 2022 · 3 comments · Fixed by #64668
Closed
10 of 12 tasks

Tracking: Improve blocks that have placeholder form #41961

t-hamano opened this issue Jun 26, 2022 · 3 comments · Fixed by #64668
Assignees
Labels
[Block] Embed Affects the Embed Block [Block] RSS Affects the RSS Block - used to display entries from an RSS/Atom feed [Block] Shortcode Affects the Shortcode Block [Block] Table Affects the Table Block [Package] Components /packages/components [Status] In Progress Tracking issues with work in progress [Type] Enhancement A suggestion for improvement.

Comments

@t-hamano
Copy link
Contributor

t-hamano commented Jun 26, 2022

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

@t-hamano t-hamano added [Package] Components /packages/components [Block] Embed Affects the Embed Block [Block] Table Affects the Table Block [Block] RSS Affects the RSS Block - used to display entries from an RSS/Atom feed [Block] Shortcode Affects the Shortcode Block labels Jun 26, 2022
@t-hamano t-hamano changed the title Tracking: Improve blocks with placeholder form Tracking: Improve blocks that have placeholder form Jun 26, 2022
@t-hamano
Copy link
Contributor Author

t-hamano commented Jul 10, 2022

Improvement Roadmap

In order to limit the impact on each component, I would like to follow these steps:

@t-hamano
Copy link
Contributor Author

Update: In #59275, the Placeholder component has been improved based on the gap layout.

@jasmussen
Copy link
Contributor

Thanks for working on this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Embed Affects the Embed Block [Block] RSS Affects the RSS Block - used to display entries from an RSS/Atom feed [Block] Shortcode Affects the Shortcode Block [Block] Table Affects the Table Block [Package] Components /packages/components [Status] In Progress Tracking issues with work in progress [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants