Skip to content

Commit dc5ed88

Browse files
committed
chore: add "aria-label" and "role" attributes to AddCommentFormView component
This change is also needed by #1484: - the "role" attribute makes the alert "searchable" by screen.getByRole() - the "aria-label" attribute makes the form "searchable" by screen.getByRole() (testing-library/dom-testing-library#474 (comment)) Part of #1493
1 parent bacab7b commit dc5ed88

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

Diff for: src/main/frontend/src/components/AddCommentForm.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,13 @@ class AddCommentFormView extends React.PureComponent {
9393
const hasValidationErrors = validationErrors.length > 0;
9494
return (
9595
<div className="col-sm-12 form-group">
96-
<form id="add-comment-form" className={ `form-horizontal ${hasValidationErrors ? 'has-error' : ''}` }
96+
<form id="add-comment-form"
97+
aria-label={ l10n['t_add_comment'] || 'Add a comment' }
98+
className={ `form-horizontal ${hasValidationErrors ? 'has-error' : ''}` }
9799
onSubmit={ handleSubmit }>
98100
<div
99101
id="add-comment-failed-msg"
102+
role="alert"
100103
className={ `alert alert-danger text-center col-sm-8 col-sm-offset-2 ${hasServerError ? '' : 'hidden'}` }>
101104
{ l10n['t_server_error'] || 'Server error' }
102105
</div>

Diff for: src/main/webapp/WEB-INF/views/series/info.html

+1
Original file line numberDiff line numberDiff line change
@@ -1251,6 +1251,7 @@ <h5 th:text="#{t_add_info_who_selling_series}">Add info about selling/buying thi
12511251
'csrfTokenValue': [[ ${_csrf.token} ]],
12521252
'l10n': {
12531253
't_server_error': [[ #{t_server_error} ]],
1254+
't_add_comment': [[ #{t_add_comment} ]],
12541255
't_comment': [[ #{t_comment} ]],
12551256
't_add': [[ #{t_add} ]]
12561257
}

0 commit comments

Comments
 (0)