Skip to content

Commit

Permalink
Post Comments: Make the button an element button (#41251)
Browse files Browse the repository at this point in the history
  • Loading branch information
scruffian authored May 24, 2022
1 parent 9614359 commit 23e3018
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
12 changes: 11 additions & 1 deletion packages/block-library/src/post-comments-form/form.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
/**
* External dependencies
*/
import classnames from 'classnames';

/**
* WordPress dependencies
*/
import { __ } from '@wordpress/i18n';
import { __experimentalElementButtonClassName } from '@wordpress/block-editor';
import { useDisabled, useInstanceId } from '@wordpress/compose';

const CommentsForm = () => {
Expand All @@ -27,7 +33,11 @@ const CommentsForm = () => {
<input
name="submit"
type="submit"
className="submit wp-block-button__link"
className={ classnames(
'submit',
'wp-block-button__link',
__experimentalElementButtonClassName
) }
label={ __( 'Post Comment' ) }
value={ __( 'Post Comment' ) }
/>
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" value="%4$s" />';
$fields['submit_button'] = '<input name="%1$s" type="submit" id="%2$s" class="%3$s wp-block-button__link ' . WP_Theme_JSON_Gutenberg::__EXPERIMENTAL_ELEMENT_BUTTON_CLASS_NAME . '" value="%4$s" />';
$fields['submit_field'] = '<p class="form-submit wp-block-button">%1$s %2$s</p>';
}

Expand Down
2 changes: 1 addition & 1 deletion packages/block-library/src/post-comments/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ function register_block_core_post_comments() {
*/
function post_comments_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" value="%4$s" />';
$fields['submit_button'] = '<input name="%1$s" type="submit" id="%2$s" class="%3$s wp-block-button__link ' . WP_Theme_JSON_Gutenberg::__EXPERIMENTAL_ELEMENT_BUTTON_CLASS_NAME . '" value="%4$s" />';
$fields['submit_field'] = '<p class="form-submit wp-block-button">%1$s %2$s</p>';
}

Expand Down

0 comments on commit 23e3018

Please sign in to comment.