-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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: Form elements #29167
Comments
I would also like to see this. |
This would alleviate the need for a CSS reset in themes in this particular aspect. I would encourage the following entry as part of the CSS:
Otherwise, it is typically browser default to have monospace font. Note: this is referenced from Andy Bell's Currently, on whether a CSS Reset is necessary for WordPress/TwentyTwentyTwo theme, which is related. |
I would be happy to get a PR going for this. If somebody already knows where in the codebase is likely the place to dig in then feel free to drop it here. Otherwise, I’ll get a PR in next day or two. |
I'm doing some initial discovery to try and move this along a bit. I'm thinking that a good start would be to perhaps add the support in
This change alone would require a significant changeset to any core blocks that use these elements, e.g. Post Comments (other?). I think we'll want to keep things simple though. Thoughts @MaggieCabrera @scruffian @kjellr @jffng ? |
👍
To get a sense for the scope of what blocks may be impacted by styling the default form elements:
This was off the top of my head but anyone feel free to add / edit. I thought the file block did but it looks like the download button uses a link and styles it to look like a button. |
I'm going to try and get a PR together for this today. |
Doing some preliminary discovery and wondering if it is advisable to make my entry point for these modifications here: |
cc @oandregal what are your thoughts on introducing form elements to global styles at this point? Do you have some guidance on how this might be implemented and what considerations should be made? |
This needs a bit more thought since it's not clear how it'd map to the block API at all, both from a user perspective and a developer perspective. Would the "button" in these form elements affect the "Button" block? Would it affect other buttons created by other block libraries? How would that connection be expressed? Is there any utility to a block author to designate an element in their block as being a form element? The components package for blocks would need to evolve to allow this mapping as well, and that needs further thought. Fine to begin explorations but we should target them for >5.9. |
Agree, there is quite a bit of nuance to consider here, and I'm mostly trying to create as small of an introduction of feature set to move it along a bit. Thanks for the insight @mtias
No, and I believe that is mostly clear by the explicit entry in I think it is confusing and partly detrimental that the Button block outputs pseudo buttons. Or in other words the Button block outputs
For the example of
Yes, I imagine so. HTML usage should be expressive and semantic. If a block author is creating a form then they should ideally use a
Yep, I imagined so.
👍 |
The problem is that it's also undifferentiated. You can use a button element to wrap around an icon and not want to inherit generic button styles as defined by To remedy that, we need to allow block authors to be able to express something like |
I have to focus on an example to extrapolate a bit further. Here is how I would add an icon inside of a
I do not believe
I believe I'm sort of following you here. I think with my example above that we would need to allow block authors a means to hook in the |
In the svg example, if the default button look has a background color but the block using the icon button need to present the icon button without a background for some reason, they'd need to preemptively overwrite the background (because they don't know if one would be set) and to do that they might reach out to CSS because there's no ergonomic way to express it in the declaration.
Correct, the expressiveness of components being a bit higher-order than the plain HTML elements allows us to hook more behaviours and assumptions while making it easier for block authors to build things that work with the system by default. |
This was why I focused my initial proposal only on I think my next logical step would be to introduce |
Upon further discovery of how to attempt to incorporate my initial proposal it seems like there is far more work than I anticipated. Originally, I had thought that the
So, this implies to me that we would have to create unique blocks for each of the elements ( I bit off way more than I could chew. 🤦 |
To provide a little more background for the uninitiated. The
Basically, |
I'm un-assigning this Issue for now, because I do not think I'll have the bandwidth, knowledge and fortitude to work through maturing some of the necessary APIs and do not want to hold up progress from anybody else. Thanks! |
Sharing this comment:
Happy to cut this from WP 5.9. My only concern is that Twenty Twenty-one might need it. What do you think @kjellr? |
We can do without this in 2022 since it needs a lot more consideration. Thanks for checking @noisysocks. |
Let's punt this then! 🥾 |
Some blocks do use actual More information: WordPress/twentytwentytwo#295 |
I had a go at adding support for a button element: #40260 |
Closing in deference to #34198 |
What problem does this address?
Most themes want to have a consistent look across all form elements, so it would be good to be able to customize these in one place.
What is your proposed solution?
We can add form elements to the list of supported elements in theme.json, so that all form elements look the same. Another way to achieve this would be to ensure that all blocks use the same inner blocks for form elements.
The text was updated successfully, but these errors were encountered: