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

Forms: improve styles naming and preview #41119

Closed
simison opened this issue Jan 16, 2025 · 3 comments · Fixed by #41457
Closed

Forms: improve styles naming and preview #41119

simison opened this issue Jan 16, 2025 · 3 comments · Fixed by #41457
Assignees
Labels
[Block] Contact Form Form block (also see Contact Form label) [Feature] Forms Blocks Blocks designed to streamline user input and engagement, such as contact, newsletter sign-ups, etc. [Package] Forms [Pri] Normal [Type] Bug When a feature is broken and / or not performing as intended

Comments

@simison
Copy link
Member

simison commented Jan 16, 2025

Block style names are somewhat obscure. Since the preview popup nor the editor don't differ at all between style switches, it's impossible to understand how they look until you switch between them.

Image

Editor

Screen.Recording.2025-01-16.at.14.02.35.mov

Frontend

Screen.Recording.2025-01-16.at.14.04.56.mov
@simison simison added [Block] Contact Form Form block (also see Contact Form label) [Feature] Forms Blocks Blocks designed to streamline user input and engagement, such as contact, newsletter sign-ups, etc. [Package] Forms [Pri] Normal [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it labels Jan 16, 2025
@ntsekouras
Copy link
Member

I'm not sure how easy would be to solve this. The reason this is happening is because the selected style actually modifies the rendered output in php. This means there is a mismatch in the html between editor and front-end.

In general block styles should just add css rules. Having said that, maybe the animated and outline should be a block property instead of styles? 🤔

Even if we do that (or something similar to match html) here comes the question of the editing experience and how you update the placeholder and the label. I didn't explore anything in depth but it seemed nuanced. Maybe placeholder is only updated through Inspector controls? 🤔

@simison
Copy link
Member Author

simison commented Jan 17, 2025

Yeah, seems like this needs some proper thinking. I'm also not sure yet how to solve this.

@talldan
Copy link
Contributor

talldan commented Jan 31, 2025

I'm not sure how easy would be to solve this. The reason this is happening is because the selected style actually modifies the rendered output in php. This means there is a mismatch in the html between editor and front-end.

When I was recently looking into another issue, I discovered that this did work in the past (the screenshots in #29178 show it). The editor seems to do the same markup changes if this is what you're referring to:

if ( style === FORM_STYLE.OUTLINED ) {
return (
<div className="notched-label">
<div className="notched-label__leading" />
<div className="notched-label__notch">
<FieldLabel className={ classes } { ...props } />
</div>
<div className="notched-label__trailing" />
</div>
);
}

I've put together a fix in #41457, but as noted in the PR it probably needs a lot of testing given these styles haven't been active for a while!

@simison simison added [Type] Bug When a feature is broken and / or not performing as intended and removed [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it labels Feb 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Contact Form Form block (also see Contact Form label) [Feature] Forms Blocks Blocks designed to streamline user input and engagement, such as contact, newsletter sign-ups, etc. [Package] Forms [Pri] Normal [Type] Bug When a feature is broken and / or not performing as intended
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants