CARVIEW |
Navigation Menu
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Global styles: add element support for text related inputs #70378
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
Conversation
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Size Change: +95 B (0%) Total Size: 1.92 MB
ℹ️ View Unchanged
|
Please don't forget to submit a core backports PR and add a changelog entry to this PR. See https://github.com/WordPress/gutenberg/blob/trunk/backport-changelog/readme.md |
yes, it was my plan as soon as I had technical feedback on the approach, thanks for the reminder! |
94a9a09
to
2c75a53
Compare
I need to update the description of the PR but after a long discussion with @mtias about what the best way forward we think it's best if we don't add an extra class we need to commit to maintaining in the future. Targeting the inputs directly instead is very similar to what we are already doing, if you look at the file changes of this PR, we are just moving the styles from stylesheets to theme.json, and the specificity stays the same, but we are adding the benefit of consistency between blocks (should we want to!) both core ones and third party ones. A few screenshots of my test site with and without the theme.json changes pointed in the description:
|
As commented on the closed PR, I am still concerned that not all text inputs needs the same styling. |
I think those can still be targeted specifically, the same way it happens with heading. If you check the implementation on lib/theme.json you can see that I've done just that. The idea/goal is that we get the form block out of the experiment (when they are ready) so 3rd party blocks can just extend them, and if a specific block needs a different style, we just use the cascade. I think elements should be an abstraction, so it wouldn't make sense to make an element specifically for the textarea, I think it's better to override the styles that don't work for it |
d68d688
to
8578ef0
Compare
8578ef0
to
28ace14
Compare
This should be ready for review now |
Co-authored-by: Aki Hamano <54422211+t-hamano@users.noreply.github.com>
This reverts commit 3d393af.
2b6ffbd
to
f5c7d78
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
HEY! This is big! Kudos folks! 👏 |
It might be advantageaous to get this added to Gutenberg 21.6 release to testing starts two weeks earlier? What do you think @cbravobernal - it missed the RC1 by just a few hours. it would also e great to test it together with the already merged PR for select and dropdown elements. |
Sure. Let's backport it. |
I just cherry-picked this PR to the release/21.6 branch to get it included in the next release: 3f75e73 |
* add textInput to the elements API and implement it to the experimental form block, updated the schema too * linting changes * removed the class and target tags directly * moved styles from blocks into theme.json * add a color for the borders * move styles for search block * linting and moving styles to the specific blocks * removed duplicated selector * missing typography styles for post comments block * backport file * Update lib/class-wp-theme-json-gutenberg.php Co-authored-by: Aki Hamano <54422211+t-hamano@users.noreply.github.com> * moved styles back to css but with lower specificity * added basic styles for the text inputs * Revert "added basic styles for the text inputs" This reverts commit 3d393af. * fix commit number * separate CSS rules to make it work with specificity * format php --------- Co-authored-by: Aki Hamano <54422211+t-hamano@users.noreply.github.com> Co-authored-by: MaggieCabrera <onemaggie@git.wordpress.org> Co-authored-by: jasmussen <joen@git.wordpress.org> Co-authored-by: getdave <get_dave@git.wordpress.org> Co-authored-by: t-hamano <wildworks@git.wordpress.org> Co-authored-by: ocean90 <ocean90@git.wordpress.org> Co-authored-by: mikachan <mikachan@git.wordpress.org> Co-authored-by: carolinan <poena@git.wordpress.org>
@MaggieCabrera what about pseudo-selectors, like
|
This would be a one liner to implement, adding this new element to the array that the button element uses to add support for pseudoselectors, but I'd wait for this recently merged PR to be tested out in the wild before adding extras to it. |
What?
Part of #34198
This PR adds elements support to text based form inputs. This PR also updates the experimental form block and the comments block to implement this.
Why?
So a theme can style consistently how forms should look like regardless of the plugins/blocks installed (if they opt in this new API)
This also opens the possibility to style the new form input blocks more granularly while making use of block tools instead of CSS, opening the option for UI controls in the future if we so desire
How?
By allowing styling of text based inputs using the elements API
Testing Instructions
/cc @WordPress/block-themers