Skip to content
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

Add help text on the HTML element for the Comments and Query Loop blocks #46989

Merged
merged 2 commits into from
Jan 11, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -6,9 +6,17 @@ import { __ } from '@wordpress/i18n';
import { InspectorControls } from '@wordpress/block-editor';

export default function CommentsInspectorControls( {
attributes: { TagName },
attributes: { tagName },
setAttributes,
} ) {
const htmlElementMessages = {
section: __(
"The <section> element should represent a standalone portion of the document that can't be better represented by another element."
),
aside: __(
"The <aside> element should represent a portion of a document whose content is only indirectly related to the document's main content."
),
};
return (
<InspectorControls>
<InspectorControls __experimentalGroup="advanced">
@@ -20,10 +28,11 @@ export default function CommentsInspectorControls( {
{ label: '<section>', value: 'section' },
{ label: '<aside>', value: 'aside' },
] }
value={ TagName }
value={ tagName }
onChange={ ( value ) =>
setAttributes( { tagName: value } )
}
help={ htmlElementMessages[ tagName ] }
/>
</InspectorControls>
</InspectorControls>
12 changes: 12 additions & 0 deletions packages/block-library/src/query/edit/query-content.js
Original file line number Diff line number Diff line change
@@ -94,6 +94,17 @@ export default function QueryContent( {
setAttributes( {
displayLayout: { ...displayLayout, ...newDisplayLayout },
} );
const htmlElementMessages = {
main: __(
'The <main> element should be used for the primary content of your document only. '
),
section: __(
"The <section> element should represent a standalone portion of the document that can't be better represented by another element."
),
aside: __(
"The <aside> element should represent a portion of a document whose content is only indirectly related to the document's main content."
),
};
return (
<>
<QueryInspectorControls
@@ -125,6 +136,7 @@ export default function QueryContent( {
onChange={ ( value ) =>
setAttributes( { tagName: value } )
}
help={ htmlElementMessages[ TagName ] }
/>
</InspectorControls>
<TagName { ...innerBlocksProps } />