Skip to content

Commit

Permalink
Post Comments block: Fix missing label in placeholder (#40527)
Browse files Browse the repository at this point in the history
  • Loading branch information
luisherranz committed Apr 22, 2022
1 parent b19b895 commit 54fd3bf
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions packages/block-library/src/post-comments/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ import {
import { __, sprintf } from '@wordpress/i18n';
import { useSelect } from '@wordpress/data';
import { useEntityProp, store as coreStore } from '@wordpress/core-data';
import { __experimentalUseDisabled as useDisabled } from '@wordpress/compose';
import {
__experimentalUseDisabled as useDisabled,
useInstanceId,
} from '@wordpress/compose';

export default function PostCommentsEdit( {
attributes: { textAlign },
Expand Down Expand Up @@ -85,6 +88,8 @@ export default function PostCommentsEdit( {

const disabledRef = useDisabled();

const textareaId = useInstanceId( PostCommentsEdit );

return (
<>
<BlockControls group="block">
Expand Down Expand Up @@ -208,11 +213,14 @@ export default function PostCommentsEdit( {

<form className="comment-form" noValidate>
<p className="comment-form-comment">
<label htmlFor="comment">
<label
htmlFor={ `comment-${ textareaId }` }
>
{ __( 'Comment' ) }{ ' ' }
<span className="required">*</span>
</label>
<textarea
id={ `comment-${ textareaId }` }
name="comment"
cols="45"
rows="8"
Expand Down

0 comments on commit 54fd3bf

Please sign in to comment.