Skip to content

Commit

Permalink
Remove core/post-comments-form block styles that are overriding butto…
Browse files Browse the repository at this point in the history
…n element styles (#42053)

* Post comments form: removing styles targeting submit button because they are overriding the core/block button styles.

* Removing just the properties provided by theme.json

* Elements: Buttons: Style the cursor for all button elements

* move to block library

* move to style.scss

* Element styles: Load them in the common.scss file instead of the style.scss file to make them available on the frontend.

* Removing elements.scss from style.scss

* core/post-comments-form: removing unneeded class from submit button to avoid unwanted styles

* default theme.json button element settings: adding border 0.

* post comments form server side rendering: removing the 'submit' css class

Co-authored-by: Ben Dwyer <[email protected]>
  • Loading branch information
matiasbenedetto and scruffian authored Jul 15, 2022
1 parent 1eb1ba1 commit 875a204
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 4 deletions.
3 changes: 3 additions & 0 deletions lib/compat/wordpress-6.1/theme.json
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,9 @@
"fontFamily": "inherit",
"lineHeight": "inherit",
"textDecoration": "none"
},
"border": {
"width": "0"
}
},
"link": {
Expand Down
2 changes: 2 additions & 0 deletions packages/block-library/src/common.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@import "./elements.scss";

// The following selectors have increased specificity (using the :root prefix)
// to assure colors take effect over another base class color, mainly to let
// the colors override the added specificity by link states such as :hover.
Expand Down
1 change: 0 additions & 1 deletion packages/block-library/src/post-comments-form/form.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ const CommentsForm = () => {
name="submit"
type="submit"
className={ classnames(
'submit',
'wp-block-button__link',
__experimentalGetElementClassName( 'button' )
) }
Expand Down
2 changes: 1 addition & 1 deletion packages/block-library/src/post-comments-form/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ function register_block_core_post_comments_form() {
*/
function post_comments_form_block_form_defaults( $fields ) {
if ( wp_is_block_theme() ) {
$fields['submit_button'] = '<input name="%1$s" type="submit" id="%2$s" class="%3$s wp-block-button__link ' . WP_Theme_JSON_Gutenberg::get_element_class_name( 'button' ) . '" value="%4$s" />';
$fields['submit_button'] = '<input name="%1$s" type="submit" id="%2$s" class="wp-block-button__link ' . WP_Theme_JSON_Gutenberg::get_element_class_name( 'button' ) . '" value="%4$s" />';
$fields['submit_field'] = '<p class="form-submit wp-block-button">%1$s %2$s</p>';
}

Expand Down
1 change: 0 additions & 1 deletion packages/block-library/src/post-comments-form/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

// Styles copied from button block styles.
input[type="submit"] {
border: none;
box-shadow: none;
cursor: pointer;
display: inline-block;
Expand Down
1 change: 0 additions & 1 deletion packages/block-library/src/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,3 @@
@import "./video/style.scss";

@import "common.scss";
@import "./elements.scss";

0 comments on commit 875a204

Please sign in to comment.