diff --git a/packages/block-library/src/post-comments-form/edit.js b/packages/block-library/src/post-comments-form/edit.js index 56eab195b4a29e..b63c798a2458af 100644 --- a/packages/block-library/src/post-comments-form/edit.js +++ b/packages/block-library/src/post-comments-form/edit.js @@ -11,6 +11,9 @@ import { BlockControls, useBlockProps, } from '@wordpress/block-editor'; +import { VisuallyHidden } from '@wordpress/components'; +import { useInstanceId } from '@wordpress/compose'; +import { __, sprintf } from '@wordpress/i18n'; /** * Internal dependencies @@ -25,10 +28,14 @@ export default function PostCommentsFormEdit( { const { textAlign } = attributes; const { postId, postType } = context; + const instanceId = useInstanceId( PostCommentsFormEdit ); + const instanceIdDesc = sprintf( 'comments-form-edit-%d-desc', instanceId ); + const blockProps = useBlockProps( { className: classnames( { [ `has-text-align-${ textAlign }` ]: textAlign, } ), + 'aria-describedby': instanceIdDesc, } ); return ( @@ -43,6 +50,9 @@ export default function PostCommentsFormEdit( {
+ + { __( 'Comments form disabled in editor.' ) } +
); diff --git a/packages/block-library/src/post-comments-form/form.js b/packages/block-library/src/post-comments-form/form.js index 0fc858c178a6e8..10483e145f709b 100644 --- a/packages/block-library/src/post-comments-form/form.js +++ b/packages/block-library/src/post-comments-form/form.js @@ -23,7 +23,11 @@ const CommentsFormPlaceholder = () => { return (

{ __( 'Leave a Reply' ) }

-
+ event.preventDefault() } + >

@@ -45,6 +50,7 @@ const CommentsFormPlaceholder = () => { ) } label={ __( 'Post Comment' ) } value={ __( 'Post Comment' ) } + aria-disabled="true" />