You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Integrate reply Comment Form into Comment pattern (#1423)
The primary focus of this PR is integrating the Comment Form for replies into the Comment pattern.
While I was working on this I made some changes to the Comment Form component and updated the code examples for all the Comment stories.
Copy file name to clipboardExpand all lines: src/components/comment-form/comment-form.stories.mdx
+31-5
Original file line number
Diff line number
Diff line change
@@ -24,7 +24,7 @@ const tyler = {
24
24
25
25
# Comment Form
26
26
27
-
The form used to add a comment to an article.
27
+
The form used to add a comment to an article. Including the `heading_id` and `help_text_id` properties will provide assistive technologies additional context.
28
28
29
29
<Canvas>
30
30
<Story
@@ -34,7 +34,11 @@ The form used to add a comment to an article.
@@ -51,12 +55,14 @@ The form used to add a comment to an article.
51
55
logged_in_user: isLoggedIn?tyler:undefined,
52
56
log_out_url: '/logout',
53
57
is_reply: isReply,
58
+
heading_id: 'leave-a-comment',
59
+
help_text_id: 'leave-a-comment-help-text',
54
60
});
55
61
}}
56
62
</Story>
57
63
</Canvas>
58
64
59
-
There is also a reply version of this component (`is_reply: true`), used to reply to an existing comment:
65
+
There is also a reply version of this component (`is_reply: true`), used to reply to an existing comment. (You'll also want to modify `heading_tag`, `heading_id`, `heading_class`, and `heading_text`. When using the [Comment pattern](/docs/components-comment--with-reply-button) this will be done automatically.)
60
66
61
67
<Canvas>
62
68
<Story
@@ -67,7 +73,16 @@ There is also a reply version of this component (`is_reply: true`), used to repl
@@ -84,6 +99,11 @@ There is also a reply version of this component (`is_reply: true`), used to repl
84
99
logged_in_user: isLoggedIn?tyler:undefined,
85
100
log_out_url: '/logout',
86
101
is_reply: isReply,
102
+
heading_id: 'reply-to-comment-100',
103
+
heading_tag: 'h4',
104
+
heading_text: 'Reply to John Doe',
105
+
heading_class: 'u-hidden-visually',
106
+
main_label: 'Reply',
87
107
});
88
108
}}
89
109
</Story>
@@ -92,6 +112,12 @@ There is also a reply version of this component (`is_reply: true`), used to repl
92
112
## Template Properties
93
113
94
114
-`class`: Append a class to the root element.
115
+
-`heading_id`: A unique ID for your heading element. This will be used as the accessible name for the form.
116
+
-`heading_tag`: The tag for your heading (defaults to `h2`).
117
+
-`heading_text`: The text for your heading.
118
+
-`heading_class`: An optional class for your heading.
119
+
-`heading_id`: A unique ID for your help text. This will be used as the accessible description for the reply textarea.
120
+
-`main_label`: The label for the primary message textarea. Defaults to `message`
95
121
-`logged_in_user`: [user object](https://timber.github.io/docs/reference/timber-user/#properties) of the type:
96
122
97
123
```ts
@@ -107,4 +133,4 @@ There is also a reply version of this component (`is_reply: true`), used to repl
107
133
108
134
## JavaScript
109
135
110
-
The Comment Form component includes the [Elastic Textarea component](http://localhost:6006/?path=/docs/components-input--elastic-textarea). See the Elastic Textarea component for JavaScript setup details.
136
+
The Comment Form component includes the [Elastic Textarea component](/docs/components-input--elastic-textarea). See the Elastic Textarea component for JavaScript setup details.
<p>Please be kind, courteous and constructive. You may use simple HTML or <ahref="https://en.support.wordpress.com/markdown-quick-reference">Markdown</a> in your comments. All fields are required.</p>
0 commit comments