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

Global Styles: Add conditional Placeholder for Custom CSS when it is for a block #49627

Closed

Conversation

jordesign
Copy link
Contributor

What?

This PR adds placeholder text to the Custom CSS textarea conditionally when the user is adding CSS at the block level (where no selector is required).

Why?

Addresses part of #49531 -placeholder to help guide the user to the correct CSS syntax when in this context.

How?

Adding a Placeholder to the CSS textarea to prompt the correct format/syntax

Testing Instructions

  1. Open the Site Editor and edit a template
  2. Open the styles panel and go to Blocks > Paragraph (or another block) > Additional CSS.

Screenshots or screencast

Screen Shot 2023-04-06 at 12 06 39 pm

@jordesign jordesign added [Type] Enhancement A suggestion for improvement. Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json labels Apr 6, 2023
@@ -112,6 +112,8 @@ function CustomCSSControl( { blockName } ) {
onBlur={ handleOnBlur }
className="edit-site-global-styles__custom-css-input"
spellCheck={ false }
/// If we are customizing at the Block level we can include placeholder text with suggested syntax
Copy link
Contributor

@glendaviesnz glendaviesnz Apr 10, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor tweak - extra / here and missing .

Suggested change
/// If we are customizing at the Block level we can include placeholder text with suggested syntax
// If we are customizing at the Block level we can include placeholder text with suggested syntax.

@glendaviesnz
Copy link
Contributor

This tested well for me and I think it is a useful addition. @carolinan do you have any thoughts on this?

@carolinan
Copy link
Contributor

carolinan commented Apr 11, 2023

I am still concerned that a user will read the placeholder and become worried because they do not know where this code is from or if they should try to remove it and how.

But it is clear from the issues opened after the feature was introduced that what we are doing right now in core and GB trunk is not working either, so let's try this.


What about printing the selector surrounding the input field?
.wp-block-blah experimental selector here {
[
this is the input field
color: red; this is the placeholder
]
}

@jordesign
Copy link
Contributor Author

@carolinan Having the placeholder note/text within the CSS code is a nice touch. I'll see about adding that in the PR.

What about printing the selector surrounding the input field?

I'm not sure about this one - I wonder if it has the potential to be more confusing, unless the overall display is really clear that's what the additional text outside of the textarea.

@jordesign jordesign closed this Jun 25, 2023
@jordesign jordesign deleted the try-placeholder-block-custom-css branch June 25, 2023 23:46
@jordesign
Copy link
Contributor Author

Closed this - as the structure of Global Styles/CSS has changed in the plugin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants